0

Tried to use Window Authentication mode for my ASP web form (So I can retrieve the current user's name when hosted with IIS), in an intratnet environment (only accessible via network login):
enter image description here

Result in error message below (The URL has 8000 character counts) :
enter image description here


Things I have attempted so far:

1) Increase maxQueryStringLength / max UrlLength in Web.config:

 httpRuntime maxQueryStringLength="2097151" maxUrlLength="10999" targetFramework="4.5"  

2) Make sure I do not have any redirect in my code:
Error Redirect Loop

3) Remove blackslash at the end of my URL:
Remove Trailing Slash From the URL

4) Set UsePortNumber to true to preserve the port number:
https://searchcode.com/codesearch/view/14375781/

5) Cleared browser cookie

Also there're some client-side javascript on my default.aspx that only check target browser (IE / Chrome / etc). Is there some pieces I am missing that needs to resolve the URL too long issue? Also, it is normal to have such long URL?

Community
  • 1
  • 1
Alex
  • 1,632
  • 1
  • 12
  • 28
  • 1
    Here's an [infinite loop answer](http://port135.com/2014/11/24/infinite-redirect-loop-to-login-page-in-asp-net/) but it's very specific so might not be your problem. – ourmandave Dec 01 '15 at 18:52
  • @AmalDev thank you I will have a look and let you know soon – Alex Dec 01 '15 at 18:54
  • 1
    There's also [this](http://stackoverflow.com/a/19601719/3585500) about IIS Express adding it's own authentication rules. Actually the whole page is filled with ideas but their aimed at MVC5. – ourmandave Dec 01 '15 at 18:55
  • @AmalDev your link on the first comment resolved the issue. Disabling UseCookieAuthentication helps. I wonder if those line are for cookie to store data only? Also, please post it as an answer so I can accept it! – Alex Dec 01 '15 at 20:46

1 Answers1

1

I had this exact same problem. It is caused bny disabling the Anonymous Authentication on the site. The solution that I found was to add the following to my appsettings in the web.config file:

<add key="owin:AutomaticAppStartup" value="false"/>
Danny
  • 111
  • 1
  • 6
  • Thanks for your answer. I had disabled UseCookieAuthentication and it resolved the problem. I will also try disabling anonymous Auth and see and I have a feeling they're disabling the same occurrence of a specific authentication. – Alex Mar 22 '17 at 17:23