473,692 Members | 2,525 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 6429
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
1030
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
7129
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? MyMembershipProvider myProvider=new MyMembershipProvider();
5
1474
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 page, the Loginname control does not show the user login name. It is empty. Do I need to configure...
1
1286
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 controls) Thanks in advance
0
1171
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 based on folders. We'd like to just use the built in Membership and MembershipUser help and not have...
2
3195
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 the new password sent to them via email? thanks is advance for any assitance,
8
2135
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 work.
1
1268
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
1288
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 username and password values check with all the values in the table. If this username and password...
0
8611
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8548
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9090
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
8970
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8813
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7641
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 project—planning, coding, testing, and deployment—without 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
6462
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
4331
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...
3
1966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.