當控件到達response.redirect行時,在瀏覽器中產生以下錯誤。 response.redirect中的網址是正確的。
頁面沒有正確重定向response.redirect does not 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);
}
}
}
在IE和Fiddler中會發生什麼? – SLaks 2010-07-06 18:46:42
你在使用IIS7嗎? – 2010-07-06 18:49:10
在IE中它永遠需要。並沒有任何反應.. – Jaspal 2010-07-06 18:53:29