需要弹出消息 [英] required a popup message
问题描述
嗨朋友们,
如果会话到期,
会重定向到登录页面。
工作正常。
但我需要一个弹出消息,说明会话已过期。如果我在此弹出消息上单击确定,则必须重定向到登录页面。否则它必须保留旧页面本身
这是我的代码
protected void Page_Load( object sender ,EventArgs e)
{
string ToRedirectURL = < span class =code-string> Login.aspx;
Response.AppendHeader( REFRESH, 60; URL = + ToRedirectURL);
}
我认为必须在那里添加这个弹出脚本。
ScriptManager.RegisterStartupScript(this,this.GetType(),RunCode,javascript:alert('抱歉,您的会话超时。单击确定以重定向到登录页面,取消以保持同一页面');文档。 location.href ='Login.aspx';,true);
请帮帮我。
谢谢。
在您的页面中添加此脚本: -
函数SessionExpire()
{
var answer = confirm( 抱歉,您的会话超时。单击确定重定向o登录页面,取消以保持同一页面)
如果(回答){
window.location.href = < span class =code-string> ./ Login.aspx;
return true ;
}
其他 {
return 假跨度>;
}
}
和来自密码的电话: -
ScriptManager.RegisterStartupScript(this,GetType(),SessionMsg,SessionExpire();,true);
在重定向到之前写入登录页面
Responce.Write(< script> alert('session expired')< / script>);
Responce.Redirect( login.aspx的);
Hi friends,
am redirecting to login page if the session expires.
its working fine.
But i need a popup message that ur session has expired. IF i click ok on this popup message it must redirect to login page. otherwise it must stay of old page itself
This is my code
protected void Page_Load(object sender, EventArgs e)
{
string ToRedirectURL = "Login.aspx";
Response.AppendHeader("REFRESH", "60;URL=" + ToRedirectURL);
}
I think this popup script must be added there.
ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('Sorry, your session timed out. Click OK to redirect to Login page, Cancel to stay of same page');document.location.href='Login.aspx';", true);
Please can you help me.
Thanks.
Add this script in your page:-
function SessionExpire() { var answer = confirm("Sorry, your session timed out. Click OK to redirect to Login page, Cancel to stay of same page") if (answer){ window.location.href="./Login.aspx"; return true; } else{ return false; } }
and call from code behind:-
ScriptManager.RegisterStartupScript(this, GetType(), "SessionMsg", "SessionExpire();", true);
write before redirecting to login page
Responce.Write("<script>alert('session expired')</script>");
Responce.Redirect("login.aspx");
这篇关于需要弹出消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!