例如判断Session是否为空,空则跳转
解决方案 »
- 程序把数据库中某些信息置空了,MS SQL怎么恢复过来
- 求高手指点(asp.net中用treeview做资源管理器)
- 紧急问一个问题?
- 菜鸟想确认一些问题 关于SESSION 和 COOKIES的
- 分页的DataGrid点击刷新出现问题
- 为什么在后台程序里声明的全局变量不能用在前台。
- 求助:asp.net动态控件的事件绑定问题?AddHandler和Addressof。帮帮忙
- 在<Form>标记里面,设置action问题.
- windfun(风之游侠)!Help!dotnetfx.exe是什么?哪有下载?
- 請製作類似Ctrl + F + Enter 功能?
- 数组a[i],现在要被用来sql搜索,要怎么应用呢
- 求从数据库中读取5张图片,显示图片切换功能代码
class AuthenticModule:IHttpModule
{
public void Dispose(){}
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
}
void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
HttpApplication ha = (HttpApplication)sender;
string path = ha.Context.Request.Url.ToString();
int n = path.ToLower().IndexOf("Login.aspx");
if (n == -1)
{
if (ha.Context.Session["user"] == null) {
ha.Context.Response.Redirect("Login.aspx?source=" + path);
}
}
}
}
}
参考