Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 16th, 2007, 01:45 PM
Authorized User
Join Date: Oct 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to redirect an non-registered admin to login

Hello All,
            I am developing a Shopping Cart application in which according to our client's requirement i am having 2 different login pages for admin and for users. Now the problem is that i am having a separate folder "Admin" and what i want to do is whenever in the browser if someone types the url of any of the .aspx pages of the admin folder he should get redirected to the admin login page and once logged in he can have access to admin folder. For this in main project's web.config i am writing it as -
<location path="Admin">
<allow users="?"/>
<deny users="*"/>

Please suggest me how to proceed and correct the code. Your help is highly appreciated. Thanks in advance.

  #2 (permalink)  
Old November 16th, 2007, 02:10 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

This literally says
<allow users="?"/>
<deny users="*"/>

Allow all anon users and deny everyone.

In any event, I would create a second web.config in my admin directory with this code:
     <authentication mode="Forms"/>
     <forms name="login" loginUrl="login.aspx" />
         <deny users="?"/>

Also take a look at these URLs


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
  #3 (permalink)  
Old November 21st, 2007, 11:23 AM
Friend of Wrox
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post

are you using roles and management of asp.net 2.0?

  #4 (permalink)  
Old November 22nd, 2007, 07:17 AM
Friend of Wrox
Join Date: May 2006
Location: Northampton, United Kingdom.
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts

Set up a role then in page.load check the role the user belongs to

If User.Identity.IsAuthenticated = False Then
  If (Roles.IsUserInRole(User.Identity.Name, "Admin")) Then
     Response.Redirect("DefaultLoginforNormalUser.aspx" )
  End If
End If

Not necessarily the best solution but it might help.

  #5 (permalink)  
Old November 26th, 2007, 08:47 AM
Authorized User
Join Date: Oct 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you all but dparsons your idea worked............thanks a lot and thanks to all.....


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
CMS - admin login does not work peppie BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 October 20th, 2007 08:46 AM
Admin login help banned Classic ASP Databases 2 May 8th, 2006 07:50 PM
admin login mujnu PHP How-To 0 February 5th, 2006 08:03 AM
Unable to login - Email address not registered ??! xrow Forum and Wrox.com Feedback 2 November 19th, 2004 06:28 AM
can't login into PHPNuke as admin anshul Pro PHP 0 August 5th, 2004 04:16 AM

All times are GMT -4. The time now is 02:21 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.