i'm using visual studio 2013 , working on asp web project. since i'm new development, have issue.
the scenario this. when user login in, since web service based project, apart username , passwords service return values. have keep values such user name, address, age throughout application until log out.
i have tried keep values using this,
public class constants { public static string address; public static string age; public static string tele; }
so can use classname.address likewise. when this, if 2 people try access @ same time, it's not working , know not valid method. please me on this. how should implement this, better if have small sample code. thank you.
you can implement using session variable session remains different users login in web application.
you can store value in session in login buttons click event as.
session["username"]=xyz; session["pass"]=*****; session["age"]=20;
etc...
and can retrive values session whenever required as.
string uname=convert.tostring(session["username"]); string pass=convert.tostring(session["pass"]);
etc..
make sure need explicitly cast value in desired type session return in object form.
Comments
Post a Comment