auto Session check

R

rony_16

hi ,
i want to override the object session in class page , because i want to
check the Session["UserName"] automaticly in WebForm , without writing
"if" in evry page .

i know that i need to make a new class Lib and inharite from "page" .
but should i write in the fuction "public override HttpSessionState
Session" ???

Please Help me !!!
 
R

Robbe Morris [C# MVP]

I typically create a class with nothing but properties
for section objects. Then, hide the Session[] stuff
in the get/set.

Everywhere else in the app, I get intellisense
for my session variables. Plus, it makes it
easy to avoid those types of null errors.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top