For storing session id, form id, user identifier i am using static varible in some form but now my client say's your static varible create a problem like some people see another data of another user(my client is also developer). So he told me remove that
static varible from the form. And if I use the non static varible then after post back the value in the varible is showing null. So how i replace that static varibles. (Some of my colleague suggest me use hidden field is that a proper way? )
I am already use the strongly type session for storing some information. but in specific form i want to use some session values more than 50 times that's why i store that session values in static varibles and use that static varibles.
that query string data come from dynamically from web service call and client not give me the DataBase Access.
And from that web service call some 10-15 forms are created then user can open any number of form in tab and as per each form i have to maintain that form id and i have to use that form id to post the user response
When the page reload at the time of postback that time store static varible in DataBase on server side cleared and throwing null. and i can't make that Db as static. So i set static varibles in hidden fields and now it works fine.
Thanks to all above replied persons.
Dinesh (Microsoft Lover)
Marked as answer by deshmukhdinesh on Feb 28, 2012 06:27 PM
deshmukhdine...
Member
12 Points
9 Posts
I want to replace static varible ? So what i use
Feb 21, 2012 11:08 AM|LINK
For storing session id, form id, user identifier i am using static varible in some form but now my client say's your static varible create a problem like some people see another data of another user(my client is also developer). So he told me remove that static varible from the form. And if I use the non static varible then after post back the value in the varible is showing null. So how i replace that static varibles. (Some of my colleague suggest me use hidden field is that a proper way? )
me_ritz
Star
9337 Points
1447 Posts
Re: I want to replace static varible ? So what i use
Feb 21, 2012 11:11 AM|LINK
For storing user specifice data...on the server-side "Session" is suggested.
More info:
http://msdn.microsoft.com/en-us/library/ms178581.aspx
deshmukhdine...
Member
12 Points
9 Posts
Re: I want to replace static varible ? So what i use
Feb 21, 2012 11:18 AM|LINK
I am already use the strongly type session for storing some information. but in specific form i want to use some session values more than 50 times that's why i store that session values in static varibles and use that static varibles.
me_ritz
Star
9337 Points
1447 Posts
Re: I want to replace static varible ? So what i use
Feb 21, 2012 11:24 AM|LINK
Ok..what you can do is, expose your session variables through property....and use it..
e.g.
public string FormID
{
get
{
if(Session["FormId"] != null)
return (string)Session["FormId"];
}
}
deshmukhdine...
Member
12 Points
9 Posts
Re: I want to replace static varible ? So what i use
Feb 21, 2012 12:37 PM|LINK
and some static varible store the query string data in it. and I can't store that thing's in session so how i handle that things
ramiramilu
All-Star
95373 Points
14096 Posts
Re: I want to replace static varible ? So what i use
Feb 21, 2012 12:48 PM|LINK
Static variables will be common for all users...either opt for session or database records for getting user specific data..
Thanks,
JumpStart
deshmukhdine...
Member
12 Points
9 Posts
Re: I want to replace static varible ? So what i use
Feb 21, 2012 01:22 PM|LINK
that query string data come from dynamically from web service call and client not give me the DataBase Access.
And from that web service call some 10-15 forms are created then user can open any number of form in tab and as per each form i have to maintain that form id and i have to use that form id to post the user response
Zhongqing Ta...
Star
10512 Points
1354 Posts
Re: I want to replace static varible ? So what i use
Feb 24, 2012 04:15 AM|LINK
Hi,
You can store static varible in DataBase on server side.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
deshmukhdine...
Member
12 Points
9 Posts
Re: I want to replace static varible ? So what i use
Feb 28, 2012 06:27 PM|LINK
When the page reload at the time of postback that time store static varible in DataBase on server side cleared and throwing null. and i can't make that Db as static. So i set static varibles in hidden fields and now it works fine.
Thanks to all above replied persons.