How ASP.NET find Login page?

M

Morgan Cheng

In VS2005, I create a ASP.NET website project.One page named
Default.aspx with LoginView and LoginStatus controls; and one page
named Login.aspx with Login control in it. After setup of users, I
press Ctrl+F5, IE window is popped up, redirect to Login.aspx page ask
me to input username and password. This works fine.

I am wondering, how does ASP.NET know to redirect to Login.aspx from
Default.aspx? I renamed Login.aspx to something else, and it still
works fine.

I add another page named AnotherLogin.aspx with Login Control too.
But, Default.aspx doesn't redirect to AnotherLogin.aspx, but to
original Login.aspx. What's the connection between Default.aspx and
Login.aspx? How to configure it?

Thanks
 
M

Morgan Cheng

I did some investigation and found that loginurl can be configured in
web.config, like
<system.web>
<authentication mode="forms">
<forms loginUrl="AnotherLogin.aspx"></forms>
</authentication>
</system.web>

However, without this configuration, the loginurl is Login.aspx. I
even tried to rename Login.aspx to ABCLogin.aspx, then loginurl is
ABCLogin.aspx. But, I cannot find any default config in the project's
folder. Or, just guessing, VS2005 make the first created login page as
default?
 
C

Cowboy \(Gregory A. Beamer\)

If you use the VS tools to help set up login, it will place the config
element for you. It will also watch page name changes and adjust config
accordingly. You can "trick" it and mess things up, if you try reallly hard.
Fortunately, it is a simple matter of manually configuring through the
config file. ;-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*********************************************
Think outside the box!
*********************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top