How to pass values across the pages in ASP.net without using Session

https://stackoverflow.com/questions/14956027/how-to-pass-values-across-the-pages-in-asp-net-without-using-sessionweb

You can pass values from one page to another by followings..cookie

Response.Redirect Cookies Application Variables HttpContext

Response.Redirectsession

SET :app

Response.Redirect("Defaultaspx?Name=Pandian");

GET :post

string Name = Request.QueryString["Name"];

Cookiesspa

SET :code

HttpCookie cookName = new HttpCookie("Name"); cookName.Value = "Pandian";

GET :ci

string name = Request.Cookies["Name"].Value;

Application Variablesget

SET :string

Application["Name"] = "pandian";

GET :

string Name = Application["Name"].ToString();

Refer the full content here : Pass values from one to another

 

Note:

 for the cookies, and the Application. Especial the Application is not working if you use webgarden or webfarm !. And the application variables are a simple Dictionary<> that exist only for compatibility with the old asp and is not to be used. Also the cookies are not for transfer data from page to page like that. Very bad design, not good practice.

相關文章
相關標籤/搜索