I am working on a website and this is my first web project. Scenario for Session I have created a database for my project with security level little bit high. I want to manage session for each and every user who is logging in to my website. Session state can be used using Cookie as well as URL, only one at a time. Now I went over with all four session state modes. i.e 1. InProc 2. State Server 3. Sql Server 4. Custom
Now after reviewing from all these modes I am in confusion which one should I use Sql Server or Custom. Basically i want to store session related information in my own database instead of Aspnet_db which is a default database provided by microsoft. I have created all tables related to login and registration. But I dont know how to store session into my database. What tables do I need to create so as to maintain into database. I want to create a complete log of session and login related information into my database(Persistant atleast for 1 year). I want to use machinekey as AES and SHA1.
What all things do i need to specify in webconfig? My Data Source= 192.168.1.5 Database name= db.mdf What I need to know about. What tables do i need to add to my database to store session related information. eg. Session id (Any other field is also stored or not), Session Time, Session Start Time, Session End Time, Session Expire Time. I dont know what all things are usually taken. Do I need to encrypt Session Id
before storing into database. If Yes Encryption will be automatic or do i need to write some code to do this other than that I wrote in web config above. How mode='custom' will be used into web config using my database. in following code
I've created a whole bunch of rather complex classes and now i'm starting to work on the ASP.net user interface. Basically the user will open 1 page which will be used to load, edit, save an object. The object has many fields and they are often other classes i've created. To create a nice interface i've used popups and used AJAX to reload parts of the page to avoid reloading the whole thing.
My plan was to create the object and save it to the session. Then each time the page is loaded copy the object values to the asp fields and do the reverse when the page has been submitted copying the asp values to the object field then updating the session object.
So the code will go something like:
if session is not null load from session otherwise create new this.txtID.text = object.id this.txtName.text = object.name etc etc
I want to be able to persist data across a session but do this outside of the built-in session state object. Why is a long story that I will not go into here. I just need to know where I can put data other than in the session object that will persist across the specific session.
Can I set the connection string for custom session state mode in global.asax file? I cannot hard code the connection string in the webconfig file. ,I will get the connection string at runtime,Can i set the connection string for custom sessionmode/sqlserver session mode in the global.asax file(like in application statrevent, or aquirerequeststate event.If YES How to do that?
I'm working on an ASP.NET MVC web application that will be deployed across multiple load-balanced servers. With this setup, a user might have one request served by server A and the next request will be served by ServerB or ServerC. We don't want to store Session Data in the database, as we're trying to minimise database hits where ever possible. As such, we need to have the HttpSession managed and stored on another server. My understanding is that this is possible by using a Windows Service that will manage this for me, but I'm unfamiliar with how to implement this. Can somebody point me at some good documentation on how to do this? Or any pitfalls or other points to take into consideration?
I have a problem to manage session variable in to different virtual directory. I need to access Session value from one virtual directory to another virtual directory. For Example I have a Web Site in my IIS with one page. Page 1
I have another virtual directory under the same Web Site with one page as follows.
I can't access session value of Page 1 from Page2!I need to access Page 1 Session value from Page 2.
Customer were getting "View State Validation Error" due to worker process recycling at our production webserver and to fix that i applied machinekey and then move my Session state Mode from In Proc to State Server to retain session data and not kick out the customer to relogin. I had serialization issue with one object which has to be stored in session but when i moved it out of session i could able to resolve the issue.
But doing all these i was partly successfull in keeping the user in their session when Worker Process recycle event occurs.I was able to refresh the page or make a post back by clicking the refresh button and also able to retain the session values. But the Problem occurs when sending asynchronous request to server which we do periodically every 15 minutes from the moment the user logs in.The web page doesnot update data on website when sending asynchronous request.By Debugging I found at this particular code point it fails to make a postback which is required.
I am new to .net 4.0 and am using EF Model and SessionState Mode=SqlServer and I am getting this error below:
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
I checked the stack trace and its complaining about
I write a simple web site in asp.net. In one page i want to delete a folder of web root. When i delete it folder, the all session in project is changed to null. I write a post in this forum. Here is the adress of it post: ([URL]) Some pepole answer me to change the session state mode to StateServer. In default the session state mode is Inproc, and i changed the session state mode to stateServer.but when i changed the session to stateserver this error is appear in application eventlog after two day and my web site dont working in iis. This error is like this:
Event Type: Warning Event Source: ASP.NET 2.0.50727.0 Event Category: Web Event Event ID: 1310 Date: 3/12/2011 Time: 1:27:55 PM User: N/A Computer: WIN2003-00A346F Description: Event code: 3009 Event message: Unable to make the session state request to the session state server. Details: last phase='Sending request to the state server', error code=0x80072749, size of outgoing data=0 Event time: 3/12/2011 1:27:55 PM Event time (UTC): 3/12/2011 8:57:55 AM Event ID: a5c8bfd16f74429e820989e8ce8082d0 Event sequence: 10 Event occurrence: 1 Event detail code: 50016 Application information: Application domain: /LM/W3SVC/1547208020/Root-1-129443938731955000 Trust level: Full Application Virtual Path: / Application Path: C:InetpubwwwrootClishareClishare Machine name: WIN2003-00A346F Process information: Process ID: 1276 Process name: aspnet_wp.exe Account name: WIN2003-00A346FASPNET Exception information: Exception type: HttpException
Exception message: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParametersAllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
Stack trace: Custom event details: For more information, see Help and Support Center at [URL]. When i reset ASP.NET State service, the problem is fixed, but after one or two days, this problem apears again. What's the problem and how can i fix it? And how can i delete a folder in asp.net without the session is lost?
In my database I have already installed the aspnetdb membership tables and process (think that was running : aspnet_regsql.exe) with all my other custom build tables for my project. All works fine.I want to use SQL server session state. (Asp.net 2.0, SQL server 2005)My project will be on a SHARED HOSTING environment, and I only want ONE database that holds all I need ( membership, custom tables, session state table, etc)I see two files in : C:WINDOWSMicrosoft.NETFrameworkv2.0.50727
I assume I run the "InstallSqlStateTemplate.sql" and follow instruction from this reference to SQL server session state operational in my single project database : [URL]
My website session was expired within seconds. I tried every possible solution but problem was same. Now i changed my session mode to stateserver, but when i logout from website its giving error. Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode. I have mention [Serializable] on class. And some of hyper links also not working after changing the mode to stateserver.
My session variables don't get saved if the SessionState mode in the web.config file is set to StateServer. But when I changed it to InProc, then everything is fine and good. I'm trying to save a custom built object (or class) into the session after the user logs in.
Have not run the ASP.NET Development Server for a while. Today I copied a production website to my workstation and ran it with VS 2008. The following error message popped up. What is the problem with the ASP.NET development Server on my workstation? The website on the Production server still ran okay.Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of KEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParametersAllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
My problem is regarding title written above. Currently I have some functions that rely on Sessions to do the job. Everything works smoothly when it is left to default. However, I do not like the idea of losing sessions in case of crash and I have modified my web.config to use Sql Server mode instead.
I have run the necessary commands to create tables and stored procedures in my database using aspnet_sql.exe. I am able to store values into the database but have not been successful retrieving them. Since it has been working fine with InProc mode, I think I can safely assume that there's nothing wrong with my codes. Here's my web.config setting:
I have two different IIS applications within the same domain(let us say www.mydomain.com) , both of these applications use the same database instance(same connectionstring), now what I want is that both of applications can see each sessions variables , can SQL Server session state mode helps in this case? Did someone try that before? Is there any other way to share the session variables?
I read the solutioin for this error, at the following link :http://forums.asp.net/p/1046935/1576341.aspxbut I am still not clear what exactly causes the error. I have two doubts :1. Can anyone please elaborate a bit on this issue, with any example ????2. Is there any drawback of this approach ?
I know this question is related to many others, but please bear with me.I am trying an experiment to store all information in database tables instead of the ASP.NET session. In ASP.NET 4 one can create a custom provider for session. So, again should I implement a Custom Session-State Provider or should I just disable session (in Web.config)?From the comments my question can be misunderstood. Hopefully this tidbit will help clarify:don't want to store the session in the database. I want to store information in the database that you would typically store in the session. One reason why: I don't want to carry around a session on every page, especially if thapage doesn't care about 90 percent of the information in the session