2.0 Login Control Not Redirecting

B

bigbrorpi

Hi -

I have forms authentication with an AD provider set up. I have a login
page Login.aspx and a Default.aspx.
When I go to Default.aspx, I get the login screen, I authenticate with
my domain name and password, and it just refreshes the login screen
(with the fields in the control being blank). I tried a bogus domain
account/password, and it rejected me, so I know that authentication IS
working.

Does anybody know why the login control wouldn't redirect me after a
successful login?
My code is below:


<web.config>

<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="30"
name="AppNameCookie"
path="/FormsAuth"
requireSSL="false"
slidingExpiration="true"
defaultUrl="Default.aspx"
cookieless="UseCookies"
enableCrossAppRedirects="false">
</forms>
</authentication>

<authorization>
<deny users="?" />
<allow users="*" />
</authorization>


<Login.aspx>

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="Login.aspx.vb" Inherits="Login"
title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:Login ID="Login1" runat="server" BackColor="#F7F6F3"
BorderColor="#E6E2D8" BorderPadding="4"
BorderStyle="Solid" BorderWidth="1px" DisplayRememberMe="False"
Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333">
<TitleTextStyle BackColor="#5D7B9D" Font-Bold="True"
Font-Size="0.9em" ForeColor="White" />
<InstructionTextStyle Font-Italic="True" ForeColor="Black" />
<TextBoxStyle Font-Size="0.8em" />
<LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775"
/>
</asp:Login>
</asp:Content>


Default.aspx is just a blank page...

Thanks!
 
C

Chunka

I had a similar problem, the login would redirect to the default.aspx
page if that was the first page i visited, as the ReturnUrl would have
a value.

I added a response.redirect into the else if there was no ReturnUrl .

Neither the login control DestinationPageUrl attribute or the default
value in web.config <authentication><forms defaultUrl="default.aspx"
.....> worked as expected.

protected void Login1_Authenticate( object sender,
AuthenticateEventArgs e )
{
if (Membership.ValidateUser(Login1.UserName, Login1.Password))
{

Response.Write("Valid UserID and Password");

if (Request.QueryString["ReturnUrl"] != null)
{
FormsAuthentication.RedirectFromLoginPage(Login1.UserName,
false);
}
else
{
FormsAuthentication.SetAuthCookie(Login1.UserName, false);

//shouldnt have to do this
Response.Redirect(Login1.DestinationPageUrl);
}
}
else
{
Response.Write("Invalid UserID and Password");
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top