1

I have a website developed in ASP.NET. I have it hosted in IIS and say the url is www.web.com. Whenever I request for this page by typing the URL in the browser I am redirected to the login page with URL like this www.web.com/Login.aspx?ReturnUrl=%2f.

I have added the following in web.config so as to make Default.aspx as my Default page.

<defaultDocument>
  <files>
    <clear/>
    <add value="Default.aspx"/>
  </files>
</defaultDocument>

Also,

<forms loginUrl="Login.aspx" defaultUrl="~/Default.aspx">

The pages are present on root folder, so I tried few things already mentioned here. Is there anything else I am missing ? A direction towards a solution or any links would be helpful.

Edit: The website redirects to Default.aspx when run on localhost

Community
  • 1
  • 1
SomeUser
  • 390
  • 8
  • 23

1 Answers1

1

A couple of minor differences, but may help. I also assume you are using IIS 7 or higher.

If they are at the same folder level, you can try:

<forms loginUrl="Logon.aspx"  defaultUrl="Default.aspx"/>

You can try:

<defaultDocument enabled="true">
  <files>
    <clear/>
    <add value="Default.aspx"/>
  </files>
</defaultDocument>
jmcclure
  • 122
  • 11
  • Yes I am using IIS 7. I tried now. Didn't work still :( – SomeUser Jul 01 '15 at 22:52
  • 2
    you can check this and see if anything helps: http://stackoverflow.com/questions/3824951/forms-authentication-ignoring-default-document – jmcclure Jul 01 '15 at 23:09
  • not much different but include the 64bit remove handler: http://stackoverflow.com/questions/6948669/iis-7-not-serving-default-document http://stackoverflow.com/questions/10300083/why-is-iis-redirecting-as-if-the-default-document-isnt-set?rq=1 http://stackoverflow.com/questions/7965600/authentication-ignoring-default-document?rq=1 – jmcclure Jul 01 '15 at 23:16
  • Slightly not related, but is related redirecting and login: http://stackoverflow.com/questions/7673233/forms-authentication-asp-net-vb/7674073#7676860 http://stackoverflow.com/questions/4935452/asp-net-re-direct-from-url-after-authentication?rq=1 – jmcclure Jul 01 '15 at 23:27
  • Thanks a lot for your efforts :). The change in Global.asax did the trick :). Its working as expected now. – SomeUser Jul 02 '15 at 20:49