Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 2nd, 2008, 02:07 PM
Registered User
 
Join Date: Sep 2008
Location: Southampton, , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How is automatic switch to login page enabled?

If you attempt to browse to the MyProfile.aspx page in the Planet Wrox website when not logged on, you will be automatically diverted to the Login.aspx page (with a query string that specifies the name of the page you were diverted from).

I would like to implement something similar in an ASP.NET app I am developing, but I can't see how it was done. If someone is able to clarify this I would be very grateful.

David

Reply With Quote
  #2 (permalink)  
Old September 2nd, 2008, 02:36 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,052
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi David,

This is a standard feature of the ASP.NET framework. You don't need to do anything to make this work.

What version of ASP.NET are you working with?

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old September 2nd, 2008, 02:48 PM
Registered User
 
Join Date: Sep 2008
Location: Southampton, , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
I'm using ASP.NET 3.5. Under what circumstances does ASP.NET cause a switch to the Login page? It can't just be the fact that you are not logged in, because no page in the app I am currently developing causes such an automatic diversion to take place.

David

Reply With Quote
  #4 (permalink)  
Old September 2nd, 2008, 03:10 PM
Registered User
 
Join Date: Sep 2008
Location: Southampton, , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,
I forgot to add my thanks for writing the book. I read it cover to cover and found it to be extremely useful, as I am totally new to ASP.NET.

David

Reply With Quote
  #5 (permalink)  
Old September 2nd, 2008, 04:19 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,052
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi David,

Yes, that's what it does by design, provided the page is protected *and* the user is currently not logged in. Take a look at the web.config for the final PlanetWrox application. You'll see <location> elements like this:
Code:
<location path="MyProfile.aspx">
  <system.web>
    <authorization>
      <deny users="?"/>
    </authorization>
  </system.web>
</location>
When non-authenticated users access the MyProfile page they are taken to Login.aspx with the original name in the querystring. That way, they are taken to that page when they login successfully. Check out chapter 15, with pages 546 to 550 in particular to see how this works.
Quote:
quote:I forgot to add my thanks for writing the book. I read it cover to cover and found it to be extremely useful
You're welcome; glad you like the book. Would you consider writing a review about it on Amazon.com?

Kind regards,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #6 (permalink)  
Old September 2nd, 2008, 04:50 PM
Registered User
 
Join Date: Sep 2008
Location: Southampton, , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah, I forgot about that setting in web.config! Now it all makes complete sense. Thanks for the clarification.

Your book is certainly worth a recommendation and I've just submitted a positive review to Amazon.co.uk.

Thanks,
David

Reply With Quote
  #7 (permalink)  
Old September 3rd, 2008, 04:59 PM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,052
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Thank you.... ;)

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
Reply


Thread Tools
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
How to do automatic page setup in word yogeshyl Word VBA 0 May 7th, 2008 05:15 AM
automatic page generation rahulcbr Beginning PHP 1 October 25th, 2006 06:16 PM
Automatic Web Login using VBA raj_phoenix Excel VBA 0 April 25th, 2006 04:19 AM
Automatic Expiry of Page problem. gaurav_jain2403 VS.NET 2002/2003 0 February 6th, 2006 01:04 PM



All times are GMT -4. The time now is 07:44 AM.


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