tags:

views:

239

answers:

7

hi,

Is there any way to preserve data throughout web application session without using session object or database?

Thanks SNA

A: 

You can pass them through the URL using

response.redirect("URL")

OR if you want to hide the variables

Server.Transfer("URL",True)
Eric
A: 

There's also ViewState, but you need to be careful with that.

Joel Coehoorn
A: 

You've a couple of options... you could persist everything on the query string e.g.

http://www.example.com/MyPage.aspx?PersistedValue1=Value1&PersistedValue2=Value2

Or you could store them in Viewstate/Cache/Application vars if they're page level or global settings.

Though I'm not really sure how any of these are any better than using Session. Why don't you want to use that.

Eoin Campbell
A: 

It depends what it is about Session and Databases that you don't like. For example:

You could setup a seperate process (like a Windows Service) to store session state information for you. That process could keep the information in memory or in files, whatever you like really. Checkout this article for more info.

You could effectively implement you're own session system that stored user specific implementation in XML files on the web server.

You could pass information from page to page using QueryString parameters.

You could use the asp.net Cache object and key the information using a UserID.

d4nt
A: 

You can create a new GUID that you send as a cookie and store the GUIDs in a custom object saved in a application object. Having said that, your application will likely perform better with the session management built into ASP.NET.

Josh
A: 

Not session? Then use Database it is the next best!

NinethSense
+1  A: 

Here are some options for persisting data:

  • Session
  • Cookies
  • URL (querystring params typically)
  • hidden form variables (including ViewState)
  • javascript data (e.g., write an array back to client on each request)
  • use IFRAMEs or framesets so that parent page doesn't change and can thus maintain state for the application
RedFilter