[Mono-list] response.redirect() infinite loop.
Joe Audette
joe_audette@yahoo.com
Wed, 27 Apr 2005 04:37:36 -0700 (PDT)
Remember that on linux everything is case sensitive.
Is your page really default.aspx or is it
Default.aspx?
I am using similar code with no problems.
My web.config:
<authentication mode="Forms">
<forms name=".ASPXAUTH" protection="All"
timeout="60" />
</authentication>
My login code:
private void AuthenticateUser()
{
string password = txtPassword.Text;
if(ConfigurationSettings.AppSettings.Get("EncryptPasswords")
== "True")
{
password = SiteUtils.Encrypt(txtPassword.Text);
}
string userName =
SiteUser.Login(siteSettings.SiteID, txtEmail.Text,
password);
if ((userName != null) && (userName != ""))
{
FormsAuthentication.SetAuthCookie(txtEmail.Text,
chkRememberMe.Checked);
if(ViewState["UrlReferrer"].ToString().Length > 0)
{
if(ViewState["UrlReferrer"].ToString().IndexOf("AccessDenied")
> -1)
{
Response.Redirect(SiteUtils.GetSiteRoot(),
false);
}
else
{
Response.Redirect(ViewState["UrlReferrer"].ToString(),
false);
}
}
else
{
Response.Redirect(SiteUtils.GetSiteRoot(),
false);
}
}
else
{
lblMessage.Text =
SiteUtils.GetMessageTemplate("LoginFailedMessage.config");
}
}
Hope it helps,
Joe Audette
--- À̿켺 <woody@monitorapp.com> wrote:
> Hello~, how are u.
>
> I'm so happy to know Mono, a beautiful job!!
>
> now i'm developing some web applications with Visual
> Studio .Net 2003 & IIS,
> and porting to Apache 2.0 with mod_mono.
>
> my mono version is 1.1.6 and my mod_mono is 1.0.8.
>
> and now i confront some trouble.
>
> after i set "Web.Config" for 'forms authentication'
> in apache html directory just like below,
>
> ...
> <authentication mode="Forms">
> <forms name="AUTH_COOKIE_NAME"
> loginUrl="login.aspx" path="/">
> </forms>
> </authentication>
> ...
>
> Response.Redirect() doesn't work and the login page
> loops infinitely.
>
> ...
> if ( ValidateUser( username, password ) == true )
> {
> FormsAuthentication.SetAuthCookie(username
> false);
> Session["UserID"] = username;
> Response.Redirect("default.aspx", false);
> }
> ...
>
> this code works very well with IIS.
> but looks doesn't work in mod_mono.
>
> Did i do something wrong?
> i'm desparate, help me plz.
>
> take care & farewell~
>
> W.S.
joe_audette [at] yahoo dotcom
http://www.joeaudette.com
http://www.mojoportal.com