1

I want to give basic IIS authentication to a website build in Sitecore. I tried with the given code, however, it is creating the number of spaces in the return URL and not rendering the authentication pop-up as expected.

https://www.sagepath.com/blogs/development/articles/basic-authentication-in-sitecore

Error is below while executing the code provided in the above blog.

Requested URL      https://sc9.cm.local:443/login?ReturnUrl=%2flogin%3fReturnUrl%3d%252flogin%253fReturnUrl%253d%25252flogin%25253fReturnUrl%25253d%2525252flogin%2525253fReturnUrl%2525253d%252525252flogin%252525253fReturnUrl%252525253d%25252525252flogin%25252525253fReturnUrl%25252525253d%2525252525252flogin%2525252525253fReturnUrl%2525252525253d%252525252525252flogin%252525252525253fReturnUrl%252525252525253d%25252525252525252flogin%25252525252525253fReturnUrl%25252525252525253d%2525252525252525252flogin%2525252525252525253fReturnUrl%2525252525252525253d%252525252525252525252flogin%252525252525252525253fReturnUrl%252525252525252525253d%25252525252525252525252flogin%25252525252525252525253fReturnUrl%25252525252525252525253d%2525252525252525252525252flogin%2525252525252525252525253fReturnUrl%2525252525252525252525253d%252525252525252525252525252flogin%252525252525252525252525253fReturnUrl%252525252525252525252525253d%25252525252525252525252525252flogin%25252525252525252525252525253fReturnUrl%25252525252525252525252525253d%2525252525252525252525252525252flogin%2525252525252525252525252525253fReturnUrl%2525252525252525252525252525253d%252525252525252525252525252525252flogin%252525252525252525252525252525253fReturnUrl%252525252525252525252525252525253d%25252525252525252525252525252525252flogin%25252525252525252525252525252525253fReturnUrl%25252525252525252525252525252525253d%2525252525252525252525252525252525252flogin%2525252525252525252525252525252525253fReturnUrl%2525252525252525252525252525252525253d%252525252525252525252525252525252525252flogin%252525252525252525252525252525252525253fReturnUrl%252525252525252525252525252525252525253d%25252525252525252525252525252525252525252flogin%25252525252525252525252525252525252525253fReturnUrl%25252525252525252525252525252525252525253d%2525252525252525252525252525252525252525252flogin%2525252525252525252525252525252525252525253fReturnUrl%2525252525252525252525252525252525252525253d%252525252525252525252525252525252525252525252flogin%252525252525252525252525252525252525252525253fReturnUrl%252525252525252525252525252525252525252525253d%25252525252525252525252525252525252525252525252f
Physical Path      C:\inetpub\wwwroot\sc9.cm.local\login
Logon Method       Not yet determined
Logon User     Not yet determined
5
  • Please note that I have enabled the basic authentication in IIS however did the provided the values in domain and realm fields. Commented Feb 6, 2020 at 13:01
  • I am a little surprised here with the blog you are referring to, how you are passing "Authorization header" in the browser? is your Basic authentication for any API call? Commented Feb 7, 2020 at 4:27
  • Code is only working after adding this line in web.config <add key="owin:AutomaticAppStartup" value="false" /> However, after entering the credentials, it is showing the below error. " No owin.Environment item was found in the context. " Commented Feb 14, 2020 at 5:48
  • I think if you can explain your requirement then people can give you some better suggestions because of the blog you are referring to is not an actual basic authentication with browser because you can't pass "Authorization header" from browser URL. Also, this will not require to enable basic authentication on IIS and owin:AutomaticAppStartup value to false. Commented Feb 14, 2020 at 7:27
  • To check how your code will work, you need to add "Modify Headers for Google Chrome" extension to add basic authentication with name "Authorization" and value "Basic Base64ValueOfUsername:Password". Commented Feb 14, 2020 at 7:31

1 Answer 1

0

Code is only working after adding this line in web.config However, after entering the credentials, it is showing the below error. " No owin.Environment item was found in the context. form Divyansh Gupta

Solution for issue: "No owin.Environment item was found in the context". We're disable Identity server:

  • Sitecore.Owin.Authentication.Disabler.config.disabled to Sitecore.Owin.Authentication.Disabler.config
  • Sitecore.Owin.Authentication.IdentityServer.Disabler.config.disabled to Sitecore.Owin.Authentication.IdentityServer.Disabler.config

Or follow link: http://www.navavayas.com/blog/disable-identity-server-in-sitecore-9x/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.