Solved

Default To Login.aspx

Posted on 2010-11-14
5
697 Views
Last Modified: 2012-06-21
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
Comment
Question by:mikesExpertExchange
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:BurnieP
ID: 34132866
You can modify your web.config file like this :

<authentication mode="Forms">
    <forms loginUrl="Login.aspx">
 </authentication>
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 34132888

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
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 34133259
@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
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 34133309

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
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 34133525
thank you. this is what i needed!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question