I want a method that works in every page in my website
I have done this so far
Expand|Select|Wrap|Line Numbers
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Web.Sessionstate;
- public class SafeClass
- {
- public bool Safepage()
- {
- bool safe = true;
- if (Session["USERID"] == null) safe = false;
- else
- {
- if (Request.QueryString["ID"] != null)
- {
- if (Request.QueryString["ID"] != Session["USERID"].ToString()) safe = false;
- }
- else
- safe = false;
- }
- return safe;
- }
- }
- The name 'Session' does not exist in the current context
- The name 'Request' does not exist in the current context
- The name 'Request' does not exist in the current context
- The name 'Session' does not exist in the current context
Why?
I am using System.Web.Sessionstate. so it should find Session. when i have the same code in a page it works.
please help me i have search for help with this but havn't found it.