473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnAuthenticate Event, Login Controls

pj

I'm trying to redirect users to another page after they Authenticate
with the ASP.NET login controls. The user is able to login, but I
can't get the response.redire ct to work. Can anyone help?

My code is below.

Thanks,

pj
mcdba, mcp
<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SQLClie nt" %>
<%@ Import Namespace="Syst em.Web.UI.Page" %>
<%@ Import Namespace="Syst em.Web.HttpServ erUtility" %>

<script language="VB" runat="server">
Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
' Response.Redire ct("home.aspx" )
End Sub

Function SiteSpecificAut henticationMeth od(ByVal UserName As String,
ByVal Password As String) As Boolean
' Insert code that implements a site-specific custom
' authentication method here.
'
Response.Redire ct("home.aspx" )
' This example implementation always returns false.
Return False
End Function

Sub OnAuthenticate( ByVal sender As Object, ByVal e As
AuthenticateEve ntArgs)
Dim Authenticated As Boolean
Dim Login1 As Login
Authenticated =
SiteSpecificAut henticationMeth od(Login1.UserN ame, Login1.Password )

e.Authenticated = True
End Sub

</script>
<script type="text/javascript">
function popup(url){var
mypopup=window. open(url,"","wi dth=400,height= 300,top=80,left =100,status,scr ollbars")}
</script>

<div align="center">
<form runat="server" id="form1">
<asp:LoginVie w ID="LoginView1 " runat="server">
<AnonymousTempl ate>

<asp:Login ID="Login1" runat="server"
CreateUserText= "Create Consumer Account"
CreateUserUrl=" jk1register.asp x"
Orientation="Ve rtical" RememberMeSet=" true"
onauthenicate=" OnAuthenticate" >
<LayoutTemplate >

<table border="0" width="100%" id="table136" cellpadding="0"
cellspacing="1" >
<tr>
<td bgcolor="#DEE8E D" class="sidenavt itle">
<div align="center">
JK1 Account Login&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;
<span style="font-weight: 400">
<a href="bthiacctm ngmnt/jk1register.asp x">Register for an
account</a></span></div>
</td>
</tr>
<tr>
<td>
<table class="sidenavc ontent" cellPadding="0" border="0" id="table145">
<tr>
<td height="10">
<label id="LoginView1_ Login1_UserName Label"
for="LoginView1 _Login1_UserNam e">Login</label>
<br/>

<asp:TextBox ID="UserName" runat="server" style="WIDTH:
80px"></asp:TextBox><as p:RequiredField Validator ID="UserNameReq uired"
runat="server" ControlToValida te="UserName"
ErrorMessage="U ser Name is required." ToolTip="User Name is
required." ValidationGroup ="Login1">*</asp:RequiredFie ldValidator>

</td><td>
<label id="LoginView1_ Login1_Password Label"
for="LoginView1 _Login1_Passwor d">Password
<br/>

</label>
<asp:TextBox ID="Password" runat="server" TextMode="Passw ord"
style="WIDTH: 80px"></asp:TextBox><as p:RequiredField Validator
ID="PasswordReq uired" runat="server" ControlToValida te="Password"
ErrorMessage="P assword is required." ToolTip="Passwo rd is
required." ValidationGroup ="Login1">*</asp:RequiredFie ldValidator>
</td>
<td valign="bottom" >
<asp:ImageButto n ID="LoginImageB utton" runat="server"
AlternateText=" Log In" CommandName="Lo gin" width="61" height="22"

ImageUrl="~/images/submitbutton.gi f" ValidationGroup ="Login1" />
</td>
</tr>
<tr height="30">
<td colspan="3">
<a href="javascrip t:popup('jk1for gotpassword.asp x')">Forgot Login
or Password?</a>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color: red">
<asp:Literal ID="FailureText " runat="server"
EnableViewState ="False"></asp:Literal>
</td>
</tr>

</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>

</AnonymousTempla te>
<LoggedInTempla te>
<table border="0" class="sidenavc ontent" cellpadding="0"
cellspacing="1" id="table1">
<tr>
<td align="left" class="sidenavt itle" bgcolor="#DEE8E D">
<a href="bthiacctm ngmnt/home.aspx">JK1 Account
Management</a>&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;
<span style="font-weight: 400">
<asp:LoginStatu s FormatString="J K1 Account Login"
ID="LoginStatus 1" runat="server"/>
</span>
</td>
</tr>
<tr>
<td align="center">
<asp:LoginNam e FormatString="{ 0}, welcome to JK1.com!"
runat="server"> </asp:LoginName>
</td>
</tr>
</table>
</LoggedInTemplat e>

</asp:LoginView>
</form>
</div>

Nov 16 '06 #1
1 6422
You should be able to call SetAuthCookie and then do a regular
Response.Redire ct to wherever you'd like.
Here's more information:
http://authors.aspalliance.com/aspxt...uthCookie.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"pj" <pj****@yahoo.c omwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
>
I'm trying to redirect users to another page after they Authenticate
with the ASP.NET login controls. The user is able to login, but I
can't get the response.redire ct to work. Can anyone help?

My code is below.

Thanks,

pj
mcdba, mcp
<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SQLClie nt" %>
<%@ Import Namespace="Syst em.Web.UI.Page" %>
<%@ Import Namespace="Syst em.Web.HttpServ erUtility" %>

<script language="VB" runat="server">
Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
' Response.Redire ct("home.aspx" )
End Sub

Function SiteSpecificAut henticationMeth od(ByVal UserName As String,
ByVal Password As String) As Boolean
' Insert code that implements a site-specific custom
' authentication method here.
'
Response.Redire ct("home.aspx" )
' This example implementation always returns false.
Return False
End Function

Sub OnAuthenticate( ByVal sender As Object, ByVal e As
AuthenticateEve ntArgs)
Dim Authenticated As Boolean
Dim Login1 As Login
Authenticated =
SiteSpecificAut henticationMeth od(Login1.UserN ame, Login1.Password )

e.Authenticated = True
End Sub

</script>
<script type="text/javascript">
function popup(url){var
mypopup=window. open(url,"","wi dth=400,height= 300,top=80,left =100,status,scr ollbars")}
</script>

<div align="center">
<form runat="server" id="form1">
<asp:LoginVie w ID="LoginView1 " runat="server">
<AnonymousTempl ate>

<asp:Login ID="Login1" runat="server"
CreateUserText= "Create Consumer Account"
CreateUserUrl=" jk1register.asp x"
Orientation="Ve rtical" RememberMeSet=" true"
onauthenicate=" OnAuthenticate" >
<LayoutTemplate >

<table border="0" width="100%" id="table136" cellpadding="0"
cellspacing="1" >
<tr>
<td bgcolor="#DEE8E D" class="sidenavt itle">
<div align="center">
JK1 Account Login&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;
<span style="font-weight: 400">
<a href="bthiacctm ngmnt/jk1register.asp x">Register for an
account</a></span></div>
</td>
</tr>
<tr>
<td>
<table class="sidenavc ontent" cellPadding="0" border="0" id="table145">
<tr>
<td height="10">
<label id="LoginView1_ Login1_UserName Label"
for="LoginView1 _Login1_UserNam e">Login</label>
<br/>

<asp:TextBox ID="UserName" runat="server" style="WIDTH:
80px"></asp:TextBox><as p:RequiredField Validator ID="UserNameReq uired"
runat="server" ControlToValida te="UserName"
ErrorMessage="U ser Name is required." ToolTip="User Name is
required." ValidationGroup ="Login1">*</asp:RequiredFie ldValidator>

</td><td>
<label id="LoginView1_ Login1_Password Label"
for="LoginView1 _Login1_Passwor d">Password
<br/>

</label>
<asp:TextBox ID="Password" runat="server" TextMode="Passw ord"
style="WIDTH: 80px"></asp:TextBox><as p:RequiredField Validator
ID="PasswordReq uired" runat="server" ControlToValida te="Password"
ErrorMessage="P assword is required." ToolTip="Passwo rd is
required." ValidationGroup ="Login1">*</asp:RequiredFie ldValidator>
</td>
<td valign="bottom" >
<asp:ImageButto n ID="LoginImageB utton" runat="server"
AlternateText=" Log In" CommandName="Lo gin" width="61" height="22"

ImageUrl="~/images/submitbutton.gi f" ValidationGroup ="Login1" />
</td>
</tr>
<tr height="30">
<td colspan="3">
<a href="javascrip t:popup('jk1for gotpassword.asp x')">Forgot Login
or Password?</a>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color: red">
<asp:Literal ID="FailureText " runat="server"
EnableViewState ="False"></asp:Literal>
</td>
</tr>

</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>

</AnonymousTempla te>
<LoggedInTempla te>
<table border="0" class="sidenavc ontent" cellpadding="0"
cellspacing="1" id="table1">
<tr>
<td align="left" class="sidenavt itle" bgcolor="#DEE8E D">
<a href="bthiacctm ngmnt/home.aspx">JK1 Account
Management</a>&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;
<span style="font-weight: 400">
<asp:LoginStatu s FormatString="J K1 Account Login"
ID="LoginStatus 1" runat="server"/>
</span>
</td>
</tr>
<tr>
<td align="center">
<asp:LoginNam e FormatString="{ 0}, welcome to JK1.com!"
runat="server"> </asp:LoginName>
</td>
</tr>
</table>
</LoggedInTemplat e>

</asp:LoginView>
</form>
</div>

Nov 16 '06 #2

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

Similar topics

0
1026
by: Robert Rolls | last post by:
I've written a module that handles the OnAuthenticate event - What I've noticed is that for every file type that the page may have included (specifically jpg, css) the event fires. what's the best way to limit this function being called for those type of files? Robert.
3
7100
by: ad | last post by:
I have create a custom membership provider. The common usage of custom membership is set it as default Membership Provider win web.config, and use login controls with it. How can I use custom membership provider without Login Controls? For example, the name of my custom membership provider MyMembershipProvider. Is the codes below right?...
5
1471
by: Seok Bee | last post by:
Dear Experts, I an trying to use the Login controls in asp.net 2.0 in the Visual Studio 2005. I have created the login page as login.aspx and set the DestinationPageUrl to ont of my webpage. I have included the Loginname control in my destination webpage to show the current user who is logging in. However, after I login through the login...
1
1284
by: Roman | last post by:
To confirm that the e-mail supplied in the new user wizard is correct, I would like to a) change the new user template not to contain password. b) I would like to send system generated password to the user asking them to change it on the next login attempt. What would be the easiest way to accomplish this? (I suppose working with login...
0
1166
by: brown | last post by:
We started an asp.net 2.0 web site with the new login controls. It seems like the Membership and MembershipUser functionality is attached to the web site, so all the web pages for the site will have to be in the same project, in this correct? We are using the asp.net web application project model instead of the new asp.net 2.0 web site model...
2
3189
by: pj | last post by:
I'm using asp.net 2.0 login controls, When a user forgets a password, they are sent an email with the new password. Two questions.... 1) how do I format the password that is being created to be only letters and numbers? Not something like "e%QtT6.Eja%XNG" 2) how do I redirect users to a change password page, next time they login with...
8
2130
by: Brad Isaacs | last post by:
Good morning friends, I am working with Visual Studio 2005, ASP.NET 2.0 I am working with the Login controls provided my .NET 2.0, trying to make the Login1 control UserName textbox obtain SetFocus upon load of the .aspx web page but I cannot for the life of me get this to work. I tried using the defaultfocus on the Form but that did not...
1
1265
by: Vince | last post by:
Hi, While working with the Login controls, VS creates a ASPNETDB.MDF database to store user accounts. Is that database only used for the storage of login credentials and if so, does this mean my site will need a separate database to host a users profile information and other tables Ill be needing?
4
1284
by: shilpareddy2787 | last post by:
Hi, I am new to asp.net. I created an application using login controls.Now I have a problem. In SQLserver I have a database. In that I created a signup table. the data which I enter in sign up application which contains username,password and email are stored in to that table.when user wants to login he enters username and password, Now these...
0
7698
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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. ...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5513
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...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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

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.