开发者

Using Handler class

开发者 https://www.devze.com 2023-03-23 02:58 出处:网络
i have written following in the handler class to check the session satate. public void ProcessRequest(HttpContext context)

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

精彩评论

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