1. Configure Web. config
< system.web > < mode= "StateServer" stateconnectionstring= "tcpip=127.0.0.1:42424" sqlConnectionString = "Data source=127.0.0.1; Trusted_connection=yes " cookieless=" false " timeout="+ "/ ></system.web>
2. Add start-Up ASP. NET Status Service code in Global.asax
voidApplication_Start (Objectsender, EventArgs e) { //code to run when the application starts Try { //start the ASP. NET State Service stringG_servicename ="aspnet_state"; System.serviceprocess.servicecontroller[] Servicecontrollers=System.ServiceProcess.ServiceController.GetServices (); foreach(System.ServiceProcess.ServiceController Serviceinchservicecontrollers) { if(Service. ServiceName = =g_servicename) { if(Service! =NULL&& service. Status! =System.ServiceProcess.ServiceControllerStatus.Running) {service. Start (); Simpleloghelper.writeerror (G_servicename+"service is turned on"); } Else { if(Service = =NULL) {simpleloghelper.writeerror (G_servicename+"Service not installed"); } Else{simpleloghelper.writeerror (g_servicename+"Service is running ..."); } } Break; } } } Catch(Exception ex) {Simpleloghelper.writeerror (ex). ToString ()); } }
Solution for session failure due to folder operation in ASP. NET Program root directory