Wrox Programmer Forums
|
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 13th, 2009, 03:30 PM
Authorized User
 
Join Date: Jan 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default [newbie]

Listing 16-15

if (Membership.ValidateUser(TextBox1.Text, TextBox2.Text) {
FormsAuthentication.RedirectFromLoginPage(TextBox1 .Text.ToString(), false);
}
else {
Label1.Text = "You are not registered with the site.";
}

To which event (presumably within the <asp:Login> control), can I write this code?

What namespaces have to be imported to use the Membership?
include
...
using.System.Web.Security;
...
within the code file e.g. Login.aspx.cs in my case (using C#).
Is it possible to use the Import attribute within the @page directive (pg.69)?

Since Textbox1 and Textbox2 are provided as an example, how do I refer to the textboxes for User Name: and Password: within the <asp:Login> control?

 
Old March 14th, 2009, 02:38 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, you can use the Login control's LogginIn event: http://msdn.microsoft.com/en-us/libr...loggingin.aspx

Or, when you have a custom for, you can do it on a Button's click.

The Login control exposes a UserName and a Password propeprty that you can access, so there's no need to access the TextBox controls directly.

Not sure what you're asking about the namespaces. Why no simply add them using a using statement in Code Behind?

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!
The Following User Says Thank You to Imar For This Useful Post:
jon80 (March 15th, 2009)
 
Old May 3rd, 2009, 11:16 PM
Registered User
 
Join Date: May 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

good, it works





Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help the newbie!! shelly.aix Visual Basic 2008 Essentials 2 December 16th, 2008 07:35 AM
newbie jono BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 3 December 11th, 2007 03:36 PM
Newbie help... mkruger XSLT 7 October 24th, 2007 02:33 AM
NEWBIE HELP tready Beginning PHP 1 May 24th, 2006 06:41 AM
Newbie Help Sayian General .NET 1 March 30th, 2005 02:30 PM





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