J
jjjooooohhnnn
Greetings,
I have encountered what appears to be a fairly common problem:
RedirectFromLoginPage is not redirecting to RedirectUrl. I have tried
all the advice that I could on the 'net, and nothing has worked yet. My
problem is very simple. I want to redirect from a login page to the
default page in one application. I am not crossing over to other
applications in other directories on the server.
Here is a description of the problem:
- Go to http://localhost/App1. From here, you are redirected to
http://localhost/App1/login.aspx. The Address bar says
http://localhost/App1/login.aspx?ReturnUrl=/NutritionFacts/default.aspx
- Enter a username and a password. Click Login.
- You remain at the page http://localhost/App1/login.aspx. However, the
Address bar now reads http://localhost/App1/default.aspx.
I am unable to get the application to redirect to default.aspx after
successfully logging in. After logging in, if I try to manually go to
default.aspx, I am redirected to login.aspx.
Here are the details of my situation:
- I am running Microsoft Visual C# .NET (Microsoft Visual Development
Environment 2003) on XP, using IIS 5.1.
- I have an application named 'App1' located at
c:\inetpub\wwwroot\App1.
- Inside c:\inetpub\wwwroot\App1\ I have:
- default.aspx
- login.aspx
- Here is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Forms">
<forms name=".App1" loginUrl="login.aspx" protection="All"
path="/">
</forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes" cookieless="false"
timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>
- Here are the critical contents of login.aspx:
<form id="LoginForm" method="post" runat="server">
<TABLE id="LoginTable" cellSpacing="0" cellPadding="4" border="0">
<TR>
<TD align="right"><STRONG>Email address:</STRONG></TD>
<TD width="2%"></TD>
<TD><asp:textbox id="EmailAddressTextBox" tabIndex="1"
runat="server" Columns="18" MaxLength="256"></asp:textbox></TD>
</TR>
<TR>
<TD align="right"><STRONG>Password</STRONG>:</TD>
<TD></TD>
<TD><asp:textbox id="PasswordTextBox" tabIndex="2" runat="server"
Columns="18" MaxLength="16" TextMode="Password"></asp:textbox></TD>
</TR>
<TR>
<TD></TD>
<TD></TD>
<TD align="right"><asp:button id="LoginButton" tabIndex="4"
runat="server" Text="Login"></asp:button></TD>
</TR>
</TABLE>
</form>
- Here is the LoginButton method:
private void LoginButton_Click(object sender, System.EventArgs e)
{
if ( IsValid )
{
FormsAuthentication.RedirectFromLoginPage( "John", false );
}
}
- If I right-click and get the properties from Explorer for
c:\inetpub\wwwroot\App1\, under the Web Sharing tab, "Share this
folder" is selected and the alias listed is 'App1'.
- In IIS Manager, if I right-click on App1, under the 'Virtual
Directory' tab, 'App1' is the Application Name. Clicking the Directory
Security tab and then Edit for 'Anonymous access and authentication
control', the 'Anonymous access' checkbox is selected with an
appropriate IUSR_xxx user name.
That about somes up my current situation. I have spent several hours on
this and have no clue how to fix the problem. Any help is greatly
appreciated. Please let me know if you need any more information to
help diagnose the problem.
Thanks,
-=John
I have encountered what appears to be a fairly common problem:
RedirectFromLoginPage is not redirecting to RedirectUrl. I have tried
all the advice that I could on the 'net, and nothing has worked yet. My
problem is very simple. I want to redirect from a login page to the
default page in one application. I am not crossing over to other
applications in other directories on the server.
Here is a description of the problem:
- Go to http://localhost/App1. From here, you are redirected to
http://localhost/App1/login.aspx. The Address bar says
http://localhost/App1/login.aspx?ReturnUrl=/NutritionFacts/default.aspx
- Enter a username and a password. Click Login.
- You remain at the page http://localhost/App1/login.aspx. However, the
Address bar now reads http://localhost/App1/default.aspx.
I am unable to get the application to redirect to default.aspx after
successfully logging in. After logging in, if I try to manually go to
default.aspx, I am redirected to login.aspx.
Here are the details of my situation:
- I am running Microsoft Visual C# .NET (Microsoft Visual Development
Environment 2003) on XP, using IIS 5.1.
- I have an application named 'App1' located at
c:\inetpub\wwwroot\App1.
- Inside c:\inetpub\wwwroot\App1\ I have:
- default.aspx
- login.aspx
- Here is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Forms">
<forms name=".App1" loginUrl="login.aspx" protection="All"
path="/">
</forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes" cookieless="false"
timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>
- Here are the critical contents of login.aspx:
<form id="LoginForm" method="post" runat="server">
<TABLE id="LoginTable" cellSpacing="0" cellPadding="4" border="0">
<TR>
<TD align="right"><STRONG>Email address:</STRONG></TD>
<TD width="2%"></TD>
<TD><asp:textbox id="EmailAddressTextBox" tabIndex="1"
runat="server" Columns="18" MaxLength="256"></asp:textbox></TD>
</TR>
<TR>
<TD align="right"><STRONG>Password</STRONG>:</TD>
<TD></TD>
<TD><asp:textbox id="PasswordTextBox" tabIndex="2" runat="server"
Columns="18" MaxLength="16" TextMode="Password"></asp:textbox></TD>
</TR>
<TR>
<TD></TD>
<TD></TD>
<TD align="right"><asp:button id="LoginButton" tabIndex="4"
runat="server" Text="Login"></asp:button></TD>
</TR>
</TABLE>
</form>
- Here is the LoginButton method:
private void LoginButton_Click(object sender, System.EventArgs e)
{
if ( IsValid )
{
FormsAuthentication.RedirectFromLoginPage( "John", false );
}
}
- If I right-click and get the properties from Explorer for
c:\inetpub\wwwroot\App1\, under the Web Sharing tab, "Share this
folder" is selected and the alias listed is 'App1'.
- In IIS Manager, if I right-click on App1, under the 'Virtual
Directory' tab, 'App1' is the Application Name. Clicking the Directory
Security tab and then Edit for 'Anonymous access and authentication
control', the 'Anonymous access' checkbox is selected with an
appropriate IUSR_xxx user name.
That about somes up my current situation. I have spent several hours on
this and have no clue how to fix the problem. Any help is greatly
appreciated. Please let me know if you need any more information to
help diagnose the problem.
Thanks,
-=John