Ad

Login.aspx Always Wants To Be My Home Page!

- 1 answer

Just starting out in asp.net. Have just created a login.aspx page in my site and stuck on a asp login control - that's all I did. Now my Welcome.aspx page won't show as the start page of my site when I debug - even though it is set as this. Plus I have even edited my web.config - (see below) - and it still does the same thing. How do I make it work so I have my Welcome.aspx page start up as default?

<authentication mode="Forms">
      <forms defaultUrl="~/Welcome.aspx" loginUrl="~/login.aspx" timeout="1440" ></forms>
</authentication>
Ad

Answer

If you want users to access welcome.aspx without being authenticated, put welcome.aspx in a separate folder, and set up a new web.config in that sub folder. fill out the authorization section in that web.config so that the files in that folder and subfolders will be accessible by anonymous users, like this:

<authorization><allow users="?" /></authorization>
Ad
source: stackoverflow.com
Ad