473,805 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Customize Login Control

Added the Login and ValidationSumma ry controls to the default.aspx page of
VS2005 web application. Set the DestinationPage URL to a different "members
only" page, OnAuthenticate to my custom Authenticate event, and
MembershipProvi der to my custom provider.

Converted the Login control to a Template and added an additional <asp:Label
AssociatedContr olID=Department ...>Department, <asp:TextBox ID=Department
....and <asp:RequiredFi eldValidator ControlToValida te=Department ...so I
now have 3 fields to fill in to login. If I don't, the ValidationSumma ry
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_Authenti cate 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(st ring, 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_Authenti cate(object sender, AuthenticatedEv entArgs e)
{
/* Authenticate using myProvider.Vali dateUser(userNa me, password,
department) somehow? */
}
Jul 21 '06 #1
1 4684
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_Authenti cate(object sender, AuthenticatedEv entArgs e)
{
e.Authenticated = Membership.Vali dateUser(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_Authenti cate(object sender, AuthenticatedEv entArgs e)
{
e.Authenticated = MyMembership.Va lidateUser(Logi n1.UserName,
Login1.Password , Login1.Deparmen t);
}

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.Departme nt 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
1150
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 no good, I always forget my login (because I never can take my name, it's always already in use), I want somethin more unique like:
14
2636
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 template which is not such a bad thing in itself but it means all other controls in the application must also be converted to templates to maintain a consistent UI. So much for writing 70% less code when foolish morons release a control with no cancel...
1
4540
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, separate DB tables, etc). For one of these user types, the current application has an additional input field required for login… they have a username, password, and another “location code” field. Please don’t make me explain or justify this…...
1
6988
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? LoginButton.Attributes.Add("onmouseover", "this.className = 'buttonsmallover'"); LoginButton.Attributes.Add("onmouseout", "this.className = 'buttonsmall'"); -- Jeff Lynch
3
5793
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 placeholder, I have placed a Login control (Login1) and a ValidationSummary control. I have set the ValidationSummary's ValidationGroup property equal to "Login1".
1
1205
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, everything works fine. How to I have it work that if the person does not press the login button, but enters the username and password, do the login.authenicate? Thanks, Dan
5
1924
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 Login in the page and set its Visible = False instead put my own username and 3 password on the form. Then I checked 2nd and 3rd password seperately and passed username and password to Login control via its Username and Password properties but...
3
1506
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 part)... this is what I have done thus far: Created a database on a sql 2000 server and then used the aspnet_regsql tool to create the membership tables I then modified the web.config as such:
6
8081
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
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.