Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 Search this Thread Display Modes
  #1 (permalink)  
Old August 21st, 2010, 12:05 AM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default Question about page redirection - chapter 15

What makes the site go directly to Login.aspx whenever you try to cut and paste the URL of management folder without logging in as a manager (manager role)? Is it because ASP automatically detects the LOGIN CONTROL and assumes that the page which has it should be called?

Chapter 15, page 549 step 12.

thanks
Reply With Quote
  #2 (permalink)  
Old August 21st, 2010, 03:48 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Nope, it's not the Login control as you could have many different pages in your site with a Login control.

It's centralized in web.config. The <forms /> element has a loginUrl attribute that defaults to Login,aspx. You can override it if you want:

Code:
 
<authentication mode="Forms">
  <forms loginUrl="SomeOtherPage.aspx"></forms>
</authentication>
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old August 22nd, 2010, 05:00 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

thanks, but I'm referring to your C# version, I cannot find that section that you mentioned. Whenever I try to add a new album without logging in, or try to access 'my profile', it redirects me to the Login page. Is it something to do with ASP.NET <authorization> section?

thanks again.
Reply With Quote
  #4 (permalink)  
Old August 22nd, 2010, 06:40 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You can't find it, because I just made up the loginUrl. Since it has a default value of Login.aspx, there's no need to specify it explicitly.

The loginUrl just defines the default login URL. It doesn't handle the security. This is done by the <location /> elements.
Did you check out the security chapter? This stuff is discussed in great detail in that chapter.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old August 29th, 2010, 11:18 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Yes, I checked the security chapter and there was never any mention of a default file named LOGIN.ASPX that ASP.NET checks/redirects to when the attribute LoginURL is not used.

Is it always necessary to name the file Login.aspx whenever creating a login page when I decided not to use the attribute LoginURL as you have mentioned?
Reply With Quote
  #6 (permalink)  
Old August 30th, 2010, 03:43 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

No, correct. LoginUrl is not mentioned in that chapter. I corrected that in the 4.0 version of the book with:

Quote:
The authentication mechanism of ASP.NET by default assumes you have a page called Login.aspx in the root of your site that is used to let users log in. To be functional, the minimum that this page requires is a Login control. If you want to use a different page, you can specify its path in the <forms /> element under <authentication /> like this:
Code:
<authentication mode=”Forms”> <forms loginUrl=”MyLoginPage.aspx” /> </authentication>
With this configuration you tell the ASP.NET runtime to load the page MyLoginPage.aspx whenever a user needs to present her credentials. Note that on the Login page (configured in the loginUrl) the VisibleWhenLoggedIn property of the Login control has no effect. On the configured Login page, the Login control is always visible. If you want to hide it you can use a LoginView control, as you see in a later exercise.
And yes, you either need to rely on Login.aspx or override the attribute. There is a default which you can use, but obviously when you don't like the default you need to override it somehow.

I was referring to the security chapter as a response to your question of why it redirects to the login page. Access to files and folders is determined by the <location /> elements in the config file.

Hope this helps,

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old August 30th, 2010, 07:59 PM
Authorized User
Points: 81, Level: 1
Points: 81, Level: 1 Points: 81, Level: 1 Points: 81, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 19
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Thank you , this is very helpful. It has enlighten me so much. Will grab a copy of your new book from Amazon in due time so I can be updated on the changes as well.

cheers Imar
Reply With Quote
Reply


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
CHAPTER 15,PAGE 533 dyla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 April 14th, 2010 01:20 PM
CHAPTER 15,PAGE 533 dyla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 0 April 13th, 2010 10:58 AM
Chapter 15 Role Management Question will.wei BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 April 9th, 2009 02:17 AM
Chapter 15 FooReader.Net Question maxint40 BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 5 April 13th, 2007 09:14 AM
Chapter 15 - functions.php question buzzuh BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 September 7th, 2004 08:31 AM



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


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