Forms Authentication Problem?
Hi,
I have conducted a search on the forum just to see if anybody else has experienced this problem and i couldn't find any similar posts. Here goes. I have set up a basic Forms autheentication. See below:
Code:
private void Button1_Click(object sender, System.EventArgs e)
{
if (txtUsername.Text == "????" && txtPassword.Text == "?????")
{
FormsAuthentication.RedirectFromLoginPage("LoggedIn", false);
}
else
{
lblLoggedin.Text = "Login falied";
}
}
The web.config file:
Code:
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms" />
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
Now this all works on my localhost, however as soon as i upload my webconfig file onto my webserver i get the following error:
Code:
RUNTIME ERROR
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
I am totally stumped to whats wrong here?
As always any help is greatly appreciated.
Re: Forms Authentication Problem?
On the target Web folder, has your application's folder been CREATEd in IIS as a virtual application??
Does it work if you load the pages to the highest level (root) folder of the Web server and run them from there? (not in their own subfolder)
Re: Forms Authentication Problem?
Lord_Rat, thanks for your suggestion. I put all the pages in the root as you suggested and it works, why is this? For future projects, how would i get it to work should i put the pages in a subfolder?
Thanks!!!
Re: Forms Authentication Problem?
Because every dot-net app needs to reside (as its base) in the highest folder that was CREATEd as a IIS application. The root automatically is, the rest has to be done by hand.
Speak with your Web host on this one.