开发者

Using Handler class

i have written following in the handler class to check the session satate.

 public void ProcessRequest(HttpContext context)
        {
            if (context.Session["UserID"] == null || context.Session["ClientCode"] == null || context.Session["UserType"] == null)
开发者_StackOverflow            {
                context.Response.Redirect("~/LogIn.aspx");
            }
        }

now i need to make it affect on every .aspx page in my application how can i do it?


You'll either need an IHttpModule for that, or subscribe to Application.BeginRequest event somewhere in Global.asax. Former is cleaner, but requires changes to Web.config, latter is arguably less clean, but it's less code and doesn't require configuration changes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜