P
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.redirect to work. Can anyone help?
My code is below.
Thanks,
pj
mcdba, mcp
<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<%@ Import Namespace="System.Web.UI.Page" %>
<%@ Import Namespace="System.Web.HttpServerUtility" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
' Response.Redirect("home.aspx")
End Sub
Function SiteSpecificAuthenticationMethod(ByVal UserName As String,
ByVal Password As String) As Boolean
' Insert code that implements a site-specific custom
' authentication method here.
'
Response.Redirect("home.aspx")
' This example implementation always returns false.
Return False
End Function
Sub OnAuthenticate(ByVal sender As Object, ByVal e As
AuthenticateEventArgs)
Dim Authenticated As Boolean
Dim Login1 As Login
Authenticated =
SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)
e.Authenticated = True
End Sub
</script>
<script type="text/javascript">
function popup(url){var
mypopup=window.open(url,"","width=400,height=300,top=80,left=100,status,scrollbars")}
</script>
<div align="center">
<form runat="server" id="form1">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server"
CreateUserText="Create Consumer Account"
CreateUserUrl="jk1register.aspx"
Orientation="Vertical" RememberMeSet="true"
onauthenicate="OnAuthenticate">
<LayoutTemplate>
<table border="0" width="100%" id="table136" cellpadding="0"
cellspacing="1">
<tr>
<td bgcolor="#DEE8ED" class="sidenavtitle">
<div align="center">
JK1 Account Login
<span style="font-weight: 400">
<a href="bthiacctmngmnt/jk1register.aspx">Register for an
account</a></span></div>
</td>
</tr>
<tr>
<td>
<table class="sidenavcontent" cellPadding="0" border="0" id="table145">
<tr>
<td height="10">
<label id="LoginView1_Login1_UserNameLabel"
for="LoginView1_Login1_UserName">Login</label>
<br/>
<asp:TextBox ID="UserName" runat="server" style="WIDTH:
80px"></asp:TextBox><asp:RequiredFieldValidator ID="UserNameRequired"
runat="server" ControlToValidate="UserName"
ErrorMessage="User Name is required." ToolTip="User Name is
required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td><td>
<label id="LoginView1_Login1_PasswordLabel"
for="LoginView1_Login1_Password">Password
<br/>
</label>
<asp:TextBox ID="Password" runat="server" TextMode="Password"
style="WIDTH: 80px"></asp:TextBox><asp:RequiredFieldValidator
ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ToolTip="Password is
required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
<td valign="bottom">
<asp:ImageButton ID="LoginImageButton" runat="server"
AlternateText="Log In" CommandName="Login" width="61" height="22"
ImageUrl="~/images/submitbutton.gif" ValidationGroup="Login1" />
</td>
</tr>
<tr height="30">
<td colspan="3">
<a href="javascriptopup('jk1forgotpassword.aspx')">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>
</AnonymousTemplate>
<LoggedInTemplate>
<table border="0" class="sidenavcontent" cellpadding="0"
cellspacing="1" id="table1">
<tr>
<td align="left" class="sidenavtitle" bgcolor="#DEE8ED">
<a href="bthiacctmngmnt/home.aspx">JK1 Account
Management</a>
<span style="font-weight: 400">
<asp:LoginStatus FormatString="JK1 Account Login"
ID="LoginStatus1" runat="server"/>
</span>
</td>
</tr>
<tr>
<td align="center">
<asp:LoginName FormatString="{0}, welcome to JK1.com!"
runat="server"></asp:LoginName>
</td>
</tr>
</table>
</LoggedInTemplate>
</asp:LoginView>
</form>
</div>
with the ASP.NET login controls. The user is able to login, but I
can't get the response.redirect to work. Can anyone help?
My code is below.
Thanks,
pj
mcdba, mcp
<%@ Page language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<%@ Import Namespace="System.Web.UI.Page" %>
<%@ Import Namespace="System.Web.HttpServerUtility" %>
<script language="VB" runat="server">
Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
' Response.Redirect("home.aspx")
End Sub
Function SiteSpecificAuthenticationMethod(ByVal UserName As String,
ByVal Password As String) As Boolean
' Insert code that implements a site-specific custom
' authentication method here.
'
Response.Redirect("home.aspx")
' This example implementation always returns false.
Return False
End Function
Sub OnAuthenticate(ByVal sender As Object, ByVal e As
AuthenticateEventArgs)
Dim Authenticated As Boolean
Dim Login1 As Login
Authenticated =
SiteSpecificAuthenticationMethod(Login1.UserName, Login1.Password)
e.Authenticated = True
End Sub
</script>
<script type="text/javascript">
function popup(url){var
mypopup=window.open(url,"","width=400,height=300,top=80,left=100,status,scrollbars")}
</script>
<div align="center">
<form runat="server" id="form1">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server"
CreateUserText="Create Consumer Account"
CreateUserUrl="jk1register.aspx"
Orientation="Vertical" RememberMeSet="true"
onauthenicate="OnAuthenticate">
<LayoutTemplate>
<table border="0" width="100%" id="table136" cellpadding="0"
cellspacing="1">
<tr>
<td bgcolor="#DEE8ED" class="sidenavtitle">
<div align="center">
JK1 Account Login
<span style="font-weight: 400">
<a href="bthiacctmngmnt/jk1register.aspx">Register for an
account</a></span></div>
</td>
</tr>
<tr>
<td>
<table class="sidenavcontent" cellPadding="0" border="0" id="table145">
<tr>
<td height="10">
<label id="LoginView1_Login1_UserNameLabel"
for="LoginView1_Login1_UserName">Login</label>
<br/>
<asp:TextBox ID="UserName" runat="server" style="WIDTH:
80px"></asp:TextBox><asp:RequiredFieldValidator ID="UserNameRequired"
runat="server" ControlToValidate="UserName"
ErrorMessage="User Name is required." ToolTip="User Name is
required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td><td>
<label id="LoginView1_Login1_PasswordLabel"
for="LoginView1_Login1_Password">Password
<br/>
</label>
<asp:TextBox ID="Password" runat="server" TextMode="Password"
style="WIDTH: 80px"></asp:TextBox><asp:RequiredFieldValidator
ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ToolTip="Password is
required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
</td>
<td valign="bottom">
<asp:ImageButton ID="LoginImageButton" runat="server"
AlternateText="Log In" CommandName="Login" width="61" height="22"
ImageUrl="~/images/submitbutton.gif" ValidationGroup="Login1" />
</td>
</tr>
<tr height="30">
<td colspan="3">
<a href="javascriptopup('jk1forgotpassword.aspx')">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>
</AnonymousTemplate>
<LoggedInTemplate>
<table border="0" class="sidenavcontent" cellpadding="0"
cellspacing="1" id="table1">
<tr>
<td align="left" class="sidenavtitle" bgcolor="#DEE8ED">
<a href="bthiacctmngmnt/home.aspx">JK1 Account
Management</a>
<span style="font-weight: 400">
<asp:LoginStatus FormatString="JK1 Account Login"
ID="LoginStatus1" runat="server"/>
</span>
</td>
</tr>
<tr>
<td align="center">
<asp:LoginName FormatString="{0}, welcome to JK1.com!"
runat="server"></asp:LoginName>
</td>
</tr>
</table>
</LoggedInTemplate>
</asp:LoginView>
</form>
</div>