在按鈕上單擊我在JS函數中調用javascript函數我重定向到aspx頁面並在aspx頁面中我想重定向到另一頁面(此部分不管用)。 response.redirect不重新定向,只是發回當前頁面。任何想法爲什麼它不工作。Response.Redirect()不起作用.net 4.0
這裏是我的代碼:
Review.aspx:
<asp:Button ID="btnComplt" runat="server" Text="Complete" OnClientClick ="return compAsgn()" />
function compAsgn() {
if (window.confirm("Submit all images and complete the assignment?"))
window.location = "SendImages.aspx?insid=" + $("#IAssignmentId").val() + '&option=complete';
else
return false;
SendImages.aspx:
protected void Page_Load(object sender, EventArgs e)
{
assignmentId = Convert.ToInt32(Request.QueryString["insid"]);
string url = "Review.aspx?insid" + assignmentId.ToString() + "&viewOption=review";
string qstrVal = string.Empty;
qstrVal = Request.QueryString["option"].ToString().ToLower();
if (qstrVal != null && qstrVal == "complete")
{
using (ServiceClient client = new Proxies.ServiceRef.ServiceClient())
{
List<AssignmentInfo> ainfo = new List<AssignmentInfo>();
ainfo = client.GetAssignmentInfo(assignmentId);
if (ainfo.Count > 0)
{
if (ainfo[0].UploadedCount == 0)
{
// AfarSessionData class has a property called ProfileId, which is session variable.
if (AfarSessionData.ProfileId == "000000")
url = "Admin.aspx";
else
url = "HomePage.aspx";
}
}
}
}
Response.Redirect(url, false);
}
注:當我調試我看到控制擊球發送圖片頁面,但我看到response.redirect不重新定向,只是發回當前頁面。
使用Fiddler,看到標題說什麼。你應該有一個302 http狀態。 –
當它到達代碼中的那一點時,url的價值是什麼? – NotMe
Admin.aspx是URL的值 – BumbleBee