Click here to Skip to main content
15,886,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to enter a policy no. on the first page that i want to carry through another 5 pages of my web application. Which state management technique should be used considering low complexity? Please help as soon as possible.Thank You.
Posted

Hi,

You can use Sesson object, That will be unique to http session.

You can use below code to store data into session.

C#
Session["POLICYNO"] = policy_number;


Then you can access policy number in other page with below code.

C#
int policy_number;
if(Session["POLICYNO"] != null)
{
   policy_number = Convert.ToInt32(Session["POLICYNO"].ToString()); 
}
else
{
  //You can show error message with no policy number in session
}


Hope this will help you.
 
Share this answer
 
v3
Comments
Member 9497070 12-Oct-12 3:24am    
can it give any traffic problem while uplaoding on server or should i use query string because its a very small amount of data to be carried ?
Mohd. Mukhtar 12-Oct-12 3:28am    
In your case you should use session variable only, because you want to use data in multiple pages. If you use query string you need to pass data again and again in other pages and unnecessry code you need to write the other reason is query string is insecure to use.
Member 9497070 12-Oct-12 3:30am    
Ok thank u
ridoy 12-Oct-12 3:34am    
+5
Mohd. Mukhtar 12-Oct-12 3:37am    
Thanks :-)
See there are multiple options you have for transfering data from one page to another.

-View state
-Control state
-Hidden fields
-Cookies
-Query strings
-Application state
-Session state
-Profile Properties

For more info you can check this link[^]

Its all depend upon your requirements, each & every approch has some merits & demerits.

Check out this link[^], It explains advantages & disadvantages of each & every approch.

Transferring page values to another page[^]

If the policy no is small size data & it don't have any security concern you can go with query string option. You can encrypt the data if you have security issue.
 
Share this answer
 
Comments
ridoy 12-Oct-12 3:35am    
+5
Sushil Mate 12-Oct-12 4:06am    
thanks ridoy.
As per your requirement you can use any of these solutions

1) Querystring
2) Cookies
3) ViewState
4) Form Data
5) Session
 
Share this answer
 
Use Session variables. It should suffice your need.
 
Share this answer
 
v2

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