473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Customize Login Control

Added the Login and ValidationSummary controls to the default.aspx page of
VS2005 web application. Set the DestinationPageURL to a different "members
only" page, OnAuthenticate to my custom Authenticate event, and
MembershipProvider to my custom provider.

Converted the Login control to a Template and added an additional <asp:Label
AssociatedControlID=Department ...>Department, <asp:TextBox ID=Department
....and <asp:RequiredFieldValidator ControlToValidate=Department ...so I
now have 3 fields to fill in to login. If I don't, the ValidationSummary
control correctly identifies the problem so that all seems to be working.

Created my own Membership Provider, and included a ValidateUser method with
3 string parameters (as well as the usual 2 parameter override), which I
call from the Login1_Authenticate event.

Trouble is, I can't seem to get the 2 things to work together.

If I remove the OnAuthenticate then it correctly goes to the
ValidateUser(string, string) of my custom Provider, but if I include the
OnAuthenticate then it goes to the event OK, but how do I call the custom
ValidateUser method?

Hopefully someone can post the code that goes in the event -

protected void Login1_Authenticate(object sender, AuthenticatedEventArgs e)
{
/* Authenticate using myProvider.ValidateUser(userName, password,
department) somehow? */
}
Jul 21 '06 #1
1 4666
A bit more info. This is what the code looks like if I use the normal 2
parameter method for authenticating the users:

protected void Login1_Authenticate(object sender, AuthenticatedEventArgs e)
{
e.Authenticated = Membership.ValidateUser(Login1.UserName,
Login1.Password);
}

That works fine, and I know it uses the overriden ValidateUser in my custom
provider as it hits the breakpoint there, but what I really want it to say
is:

protected void Login1_Authenticate(object sender, AuthenticatedEventArgs e)
{
e.Authenticated = MyMembership.ValidateUser(Login1.UserName,
Login1.Password, Login1.Deparment);
}

But that generates an error. MyMembership doesn't exist in the current
context. OK, so lets change it to Membership then... Another error. The
Login control does not contain a definition for Department. OK, so I replace
Login1.Department with "test" and try again. This time I get a No overload
for ValidateUser takes 3 arguments. Drop the 3rd argument and I'm back to
the working 2 parameter version.

It's probably very simple, but even google doesn't find an appropriate
example.
Jul 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lloyd Dupont | last post by:
ok, I'haven' put it on my web page yet. (and I will do it tomorow, time to go to bed now) but I wonder, I've seen screenshot and it goes like that: Login: xxxxx Password: xxxxxx And that's...
14
by: clintonG | last post by:
This is an appeal for peer support sent to Microsoft as will be noted in closing. The Login control does not include a Cancel button. The only option is to convert the Login control to a...
1
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page,...
1
by: Jeff Lynch | last post by:
I'd like to add the following attributes to the Login control's Login Button to create a CSS rollover effect. How can I access the control's login button from the page's code-behind? ...
3
by: ilockett | last post by:
The background: I have a web app with a simple master page that contains just one content placeholder. I have created a web form that then uses this master page. Within the content...
1
by: Daniel Friend | last post by:
I have a page with the Login Control. If I type the user name and password and click the enter key the page reloads without doing the login.authenicate.... if I click the actual login button,...
5
by: Afshar | last post by:
Hi everybody there, I have a special Login page that wants users to enter 3 passwords rather than a single password. But can't do it with Login control. I tried following scenarios: 1. Put an...
3
by: goot | last post by:
I'm trying to use the login control and have it use the membership provider framework to authenticate users and am having a problem (which i'm sure will turn out to be a stupid mistake on my...
6
by: dan | last post by:
Hi, Could someone please let me know how to center a Login control on a page? Can I use CSS to do that? Thanks, Dan
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.