2010-07-06 6 views
3

제어가 response.redirect 행에 도달하면 브라우저에 다음 오류가 생성됩니다. response.redirect의 URL이 정확합니다.
페이지가 제대로 리디렉션되지 않습니다.response.redirect doesnt work

Firefox가 서버가이 주소에 대한 요청을 완료되지 않는 방식으로 리디렉션 중임을 감지했습니다. 여기

* This problem can sometimes be caused by disabling or refusing to accept 
     cookies. 

코드

using System; 
using System.Collections; 
using System.Configuration; 
using System.Data; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 

public partial class MasterPage : System.Web.UI.MasterPage 
{  
    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void imgbtnLogin_Click(object sender, ImageClickEventArgs e) 
    { 
     UserFunction objUser = new UserFunction(); 
     UserProperties objUserProperties = new UserProperties(); 
     IUserFunction iUserFunction = (IUserFunction)objUser; 
     objUserProperties.UserName = txtUserName.Text; 
     objUserProperties.Password = txtPassword.Text; 
     string userName = txtUserName.Text; ; 
     string password = txtPassword.Text; ; 
     DateTime login = DateTime.Now; 
     DateTime? logout = null; 
     int UserId; 
     string StartUpPage; 
     bool success = iUserFunction.ValidateUser(objUserProperties, out StartUpPage); 
     if (success) 
     { 
      Session["UserId"] = objUserProperties.UserId; 
      Session["RoleId"] = objUserProperties.RoleId; 
      Session["UserName"] = objUserProperties.UserName; 
      Session["MyTheme"] = objUserProperties.Theme; 
      iUserFunction.AddLoginHistory(objUserProperties.UserId, login, logout, 1); 
      Response.Redirect(StartUpPage); 

     } 
     else 
     { 
      Label1.Text = "Wrong UserName/password."; 
      //ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('Invalid Credential');", true); 
     } 
    } 
} 
+0

IE와 Fiddler에서 어떤 일이 발생합니까? – SLaks

+0

IIS7을 사용하고 있습니까? IE에서 –

+0

은 영원히 걸립니다. 아무 일도 일어나지 않습니다. – Jaspal

답변

2

당신이 무한 루프로 리디렉션되도록 할 수있다? 그 오류에 대한 정보에 Here is a link.

두 페이지에 대해 아래 코드를 사용했다면 이런 일이 발생할 수 있습니다.

Page1.aspx.cs :

protected void Page_Load(object sender, EventArgs e) 
{ 
    Response.Redirect(Page2Url); 
} 

Page2.aspx.cs :

protected void Page_Load(object sender, EventArgs e) 
{ 
    Response.Redirect(Page1Url); 
} 

UPDATE

당신이 긍정적 인 경우는 코드의 I에서 무한 루프 아니다 this link의 단계를 따르고 쿠키로 인해 문제가 발생하는지 확인합니다.

+0

그렇지 않습니다. 모든 설정이 정보 – Jaspal

+0

에서 언급 한대로 정확합니다. 실제로 사용자의 홈페이지로 자격 증명을 확인한 후 로그인 페이지를 리디렉션합니다. – Jaspal

+0

음, 사용자가 인증되었는지 확실합니까? –

1

동일한 페이지로 리디렉션 중이므로 무한 루프가 발생합니다.

+0

그것은 나의 추측 일 것이다. –