Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 11-Oct-12 21:07pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
You can use Sesson object, That will be unique to http session.
 
You can use below code to store data into session.
 
Session["POLICYNO"] = policy_number;
 
Then you can access policy number in other page with below code.
 
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.
  Permalink  
v3
Comments
Member 9497070 at 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 at 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 at 12-Oct-12 3:30am
   
Ok thank u
ridoy at 12-Oct-12 3:34am
   
+5
Mohd. Mukhtar at 12-Oct-12 3:37am
   
Thanks :-)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  
Comments
ridoy at 12-Oct-12 3:35am
   
+5
Sushil Mate at 12-Oct-12 4:06am
   
thanks ridoy.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

As per your requirement you can use any of these solutions
 
1) Querystring
2) Cookies
3) ViewState
4) Form Data
5) Session
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use Session variables. It should suffice your need.
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 12 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100