[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 712
  • Last Modified:

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)?
0
Michael Sterling
Asked:
Michael Sterling
  • 2
  • 2
1 Solution
 
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
 
Ephraim WangoyaCommented:

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
 
Michael SterlingWeb Applications DeveloperAuthor Commented:
thank you. this is what i needed!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now