Reputation: 41
How to use public variable in Asp.NET with vb, in my web application i have class fils,aspx and asmx file, in this all pages i need access one public variable which i assign when user login, if i use session i cant access in asmx and class files, if i declare public variable in class file once page refresh it clear the assign values and became empty.
i want assign public variable with values and access in whole application until user logout, and once assign values when login it never change.
This is for connection sting , i know can declare in web conig, but we create each sql login for each and every user, so when user login we pass username to sql User ID
What I have tried:
For now i declare static variable and used in same page itself.If asp page no problem, but from class and asmx i need to each function connection strings.
Upvotes: 0
Views: 430
Reputation: 5423
You can use Session for this, it works:
Upvotes: 3