Default To Login.aspx

Can someone point me in the direction of some links (or just show me on here) how to get my app to default to my login page (which uses authentication)?
LVL 1
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Ephraim WangoyaConnect With a Mentor Commented:

You can redirect the user to the login page if they are not yet logged in.

Add this code to page_load

protected void Page_Load(object sender, EventArgs e)
{
   if (!HttpContext.Current.User.Identity.IsAuthenticated) then
      Response.Redirect(~/login.aspx);
 
}
0
 
BurniePCommented:
You can modify your web.config file like this :

<authentication mode="Forms">
    <forms loginUrl="Login.aspx">
 </authentication>
0
 
Ephraim WangoyaCommented:

Open IIS
Got your website and right click to select properties
Go to the documents tab and add the page you would like to be the default
Set-Default-Page.png
0
 
Michael SterlingWeb Applications DeveloperAuthor Commented:
@Burnie: i do have that in my web.config

@ewongoya: i couldn't find that properties page,..i'm using IIS 7

let me explain a little further, i've got a folder within my sight that is called admin. it has it's own set of pages (i.e. default.aspx, login.aspx etc.) within it to allow administrative things to be done within the site,..so when the user goes to, for example: mySite/Admin
i want the login.aspx page to be the default page if they haven't already logged in...

0
 
Michael SterlingWeb Applications DeveloperAuthor Commented:
thank you. this is what i needed!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.