Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
hi freinds

I have created some public properties in one class and accesing in session_start event of Global.asax file.
in that event i'm assigning some values into that public properties.

now when i access those properties in class i don't get any value

code of class file:

C#
public string username
      {
          set
          {
              userName = value;
          }
          get
          {
              return userName;
          }
      }



while in global.asax code is :
obj.username = "some user name"; // here obj is object of class
please tell me where i'm getting wrong.

The purpose for doing this is whenever application starts i'll initialize this value...
Posted
Comments
Herman<T>.Instance 4-Jun-12 10:46am    
which exception(s) do you get?
Maybe show code of asax file too
Karthik. A 4-Jun-12 11:44am    
Check whether you save the instantiated class in the session! Like Session["some_key"] = obj; where obj is the instance you created and populated with the user name and other info. Copy/Paste your Global.asax.cs "Session_Start" so that 1 of us could help...
preet88 5-Jun-12 1:17am    
hi karthik yes you are correct i have resolved the problem and it is because of instance problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900