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
Register
| 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
  #11 (permalink)  
Old May 6th, 2010, 10:33 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok explain what this line of code in the Wrox book is supposed to do.

FormsAuthentication.RedirectFromLoginPage(User.Tex t, true);

Desmond

is it
a:) do nothing and keep me on the login page
b:) Allow me to navigate around the website as an authorised user
  #12 (permalink)  
Old May 6th, 2010, 10:39 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actualy the line in the book says

FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, true);


Not

FormsAuthentication.RedirectFromLoginPage(User.Tex t, true);

I changed the name of the textbox control
  #13 (permalink)  
Old May 6th, 2010, 10:42 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry my mistake I changed the false to a true to see if that was an aerror in the book. The book says

FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, False);
  #14 (permalink)  
Old May 6th, 2010, 10:43 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

So is it solved now?

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!
  #15 (permalink)  
Old May 6th, 2010, 10:50 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No it is not solved. Question REMAINS STILL

What is this line in the book supposed to do
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, False);

Note that it it says False and not false.

Code in login form ...............

protected void submit1_Click(object sender, EventArgs e)
{
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, False);
}
This should do what?
  #16 (permalink)  
Old May 6th, 2010, 10:55 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Why don't you look it up in the docs? The following URL is the "I feel lucky" in Google for RedirectFromLoginPage and provides valuable insights in this method.

http://msdn.microsoft.com/en-us/library/1f5z1yty.aspx

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!
  #17 (permalink)  
Old May 6th, 2010, 11:02 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes thats what I thought it did but it does not. WHY

Redirects an authenticated user back to the originally requested URL or the default URL using the specified cookie path for the forms-authentication cookie.

Page 679 of your book
<system.web>
<authentication mode="Forms">
<forms name="Wrox" loginUrl="Login.aspx" path="/" />
</authentication>

<authorization>
<deny users="?" />
</authorization>
</system.web>

I have a page Login.aspx (Suprise suprise) with this code

protected void submit1_Click(object sender, EventArgs e)
{
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, True);
}

as per your page 685.

This just keeps me on the Login.aspx page
  #18 (permalink)  
Old May 6th, 2010, 11:16 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There is an error in your book. The link you told me to go to states ...

public static void RedirectFromLoginPage(string userName, bool createPersistentCookie, string strCookiePath)

Can you count?

There are 3 arguments to this function not 2 as in
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, False);
  #19 (permalink)  
Old May 6th, 2010, 11:20 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I am sorry, but you may be barking up the wrong tree here. Before we continue, let's set one thing straight:

Quote:
as per your page 685.
It's not my page, nor my book. I am here on this forum just as a visitor; nothing more nothing less.

The example you're posting works fine for me with this Login page:

Code:
 
protected void Button1_Click(object sender, EventArgs e)
{
  FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
}
if I redirect Login.aspx page directly. When I enter a name, I am taken back to Default.aspx.

Are you sure your code is OK? Is the code you posted a direct copy or did you type it for this post? (It's true, not True). Also, maybe you have something in your query string?

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!
  #20 (permalink)  
Old May 6th, 2010, 11:26 AM
Registered User
 
Join Date: May 2010
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using invisible ink. There is no query or database. If you look at the code

protected void submit1_Click(object sender, EventArgs e)
{
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, false);
}

you will notice that there is no query. I am just testing this out. I am not bothered at this stage about doing a query. This is a TEST page. The line

FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text, false);

should allow me to carry on as usual. It keeps me on the login page.
The FormsAuthentication.RedirectFromLoginPage takes 3 arguments not 2

The code in the web.config file is as stated in the wrox book.

<system.web>
<authentication mode="Forms">
<forms name="Wrox" loginUrl="Login.aspx" path="/" />
</authentication>

<authorization>
<deny users="?" />
</authorization>
</system.web>

This has been copied and pasted. This has not been typed into this forum
 


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
Unable to set SelectedValue on DropDownList jlrolin ASP.NET 2.0 Professional 0 April 13th, 2007 09:30 AM
"Unable to set the FormulaArray property..." rduncan1 Excel VBA 2 August 18th, 2006 01:33 PM
Unable to set focus in VBA/Word Larry Landis Beginning VB 6 1 October 28th, 2004 03:06 PM
how to set up authentication? jackaspnet Classic ASP Databases 1 June 11th, 2004 07:09 PM
Unable To Set Picture URL In Profile Ben Horne Forum and Wrox.com Feedback 14 March 11th, 2004 05:13 PM



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


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