比如说我有个index.aspx页面,如果用户没有登录直接查看这个页面,那么我就让他转到登录页面。用户名和密码没有输入,或者错误,都能显示出来。问题是用户登录成功却不能跳到index页面。 那边是通过ashx页面处理传过来success和failed的
。function showLoginResult() {
var result = xmlHttp.responseText;
if (result == "succeed") {
window.history.go(-1);
} else {
alert("账号或密码有误");
}
}
。function showLoginResult() {
var result = xmlHttp.responseText;
if (result == "succeed") {
window.history.go(-1);
} else {
alert("账号或密码有误");
}
}
解决方案 »
- 求Paypal的支付接口C#的·有的哥们给个吧·谢谢
- 【.NET问题急救】iewebcontrol错误
- 添加了一个test.ashx页来拦截对.jpg的请求.在web.config里咋写?
- .NET导出EXCEL表格出现如下问题。力求帮忙啊,谢谢
- 错误信息如下,请问我电脑的什么服务关了啊
- 修改down.asp时遇到的问题!请高手帮忙解决!
- 关于客户端控件的取值
- asp.net中使用用户控件,如何使表格居页面的最上部
- 请教关于非托管DLL导入问题
- datagrid用按钮列更新数据的问题
- 一个windows身份验证的问题
- 派单中[asp.net+sql server设计一特殊采集站点] [2000元+模版1000元]
用alert打印出来看看
/// 防盗链(Filter)
/// </summary>
public class MyFilter:ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
//base.OnActionExecuted(filterContext);
var user=filterContext.HttpContext.Session["user"];
if (user == null)
{
filterContext.HttpContext.Response.Write("<script>alert('请登陆...')</script>");
//获取刚刚用户浏览的URL(不指定参数值)
string url = FormsAuthentication.DefaultUrl;
filterContext.HttpContext.Response.Write("<script>window.parent.location.assign('" + url + "')</script>");
}
}
}把这个单独写在一个类里面
然后在你需要的Action前面这样写
[类名]
浏览器动作history.back()更准确
参考
=================
是的,先查看条件是不是满足,另外用,go(-1)这种方式,总归不是太好,不用选用别的跳转方式,比如:window.location.href="index.aspx"