Changing Web.config And Session Lifecyle?
Jan 29, 2011If I change (and upload) the web.config of an ASP.NET site, do existing users surfing the site lose their sessions?
Also, does the IIS server need to be reset?
If I change (and upload) the web.config of an ASP.NET site, do existing users surfing the site lose their sessions?
Also, does the IIS server need to be reset?
The problem is when am assigning my session table value to newly created table and if now am changing any coloumn name then the session table value also changing.
But my question is am assigning Session value to newly created table so how should session value should be affected?
for refference in my application
sessionState
mode="InProc"
Why is knowing the Asp.net lifecyle important to coding in Asp.net?
View 10 RepliesI need to change the database connection string in the web.config file but havent got a clue how to go about this. Does anyone have any experience with that?
UPDATE
Sorry, not very clear above, I want to be able to change a connection string from the web application after it has been deployed
run asp.net 3.5 sites on asp.net 4.0 without changing codeweb.config. Is it possible?
View 3 RepliesI have an ASP.NET application running under IIS. I'd like to be able to change one of the web.config values in Application Settings. I know it's possible to change it programmatically as described in this answer but I'm wondering if the same thing can be accomplished from the command line.
The IIS 7 Manager allows application settings and connection strings (among other options) to be changed. My hope is there is a way to do the same via the command line for IIS 6 and/or 7.
Is it possible to change the url that the web service is using in the app.config file once the windows application is running? Example a user changes the index of a drop down that will change the URL of the web service?
What I'm trying to accomplish is having a drop down that will let the user select between using the web service on our dev system versus the live system.
How can I change an application setting within a web.copnfig programmatically with C# (from another application, which configures the web-application)?
The following code snipped doesn't work, because AppSettings[...] is readonly!
configuration = WebConfigurationManager.OpenWebConfiguration(...);
ConfigurationSectionGroup configurationSectionGroup = (ConfigurationSectionGroup)configuration.GetSectionGroup("applicationSettings");
ConfigurationSection configurationSection = (ConfigurationSection)configurationSectionGroup.Sections[...];
configurationSection.CurrentConfiguration.AppSettings[...].value = value
I have a framework 2.0 asp.net website, I want to change it's framework version to 3.5. Is it possible to do this manually from web.config file? I don't want to change from visual studio property pages. I need to change from web.config, what should I do?
View 2 RepliesThe basic idea is we have a test enviroment which mimics Production so customErrors="RemoteOnly". We just built a test harness that runs against the Test enviroment and detects breaks. We would like it to be able to pull back the detailed error. But we don't want to turn customErrors="On" because then it doesn't mimic Production.
I've looked around and thought a lot, and everything I've come up with isn't possible. Am I wrong about any of these points?
We can't turn customErrors on at runtime because when you call configuration.Save() - it writes the web.config to disk and now it's Off for every request.We can't symlink the files into a new top level directory with it's own web.config because we're on windows and subversion on windows doesn't do symlinks.
We can't use URL-Mapping to make an empty folder dir2 with its own web.config and make the files in dir1 appear to be in dir2 - the web.config doesn't apply. We can't copy all the aspx files into dir2 with it's own web.config because none of the links would be consistent and it's a horrible hacky solution.
We can't change customErrors in web.config based on hostname (e.g. add another dns entry to the test server) because it's not possible/supported. We can't do any virtual directory shenanigans to make it work.
If I'm not, is there a way to accomplish what I'm trying to do? Turn on customErrors site-wide under certain circumstances (dns name or even a querystring value)?
Is it ok to change the config file after publishing a site? I use shared hosting. It would be nice to do things like change connection strings and smtp settings with out having to republish the site.
View 4 RepliesMy requirement is to save the connection string of database that will be provided to be me by user on form, which can be modified lator.
i need to know how and where i should store the connection string permanently which will be used lator to connect to database.
My web.config is set up so that I don't have to change anything between deploy from UAT and Production. I can determine what machine it is running on and then programatically pick the correct connection string etc from the web.config based on the name.
Now we are adding a call to a web service which now causes us to have to make a change at deploy time. We set a "Region" flag in the web.config and then in coded an IF statement to call the appropriate webservice based on the flag so all we'd have to change is the "T" to a "P" when moving to production. But then hardcoding a web service in the application is not what we want to do. Nor do we want to change the web service address in the web.config.
Is there any way we can do something like the following to be able to not have to change the web.config at deploy?
It would be something like:
1. Grab current Machine name
2. Look in web.config for corresponding machine name web service reference (like we do for connection strings etc)
3. Use that web service in the processing.
I'm working on different windows machines and virtual windows machines on a mac. I have a project wich uses SQL server and AD for autentication.
Right now I have to be connected to VPN so that the asp.net web application can connect to AD using LDAP string to autentivate users, I also have the SQL server on the other side of the VPN connection.
Is there any way to setup my enviroment so that I can work locally without the AD, and on a local SQL server and be able to publish the project without manually changing the web.config file?
I'm using ASP.NET Session State to keep track of logged in users on my site. However, one problem I'm running into is that by default ASP.NET session cookies are set to expire when the browser closes. I've tried setting my own ASP.NET_SessionId cookie and modifying the cookie's expiry using something similar to the following code:
Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(1);
None of these approaches work, they all set a second cookie with the same name. Is there a way of changing the session cookie's expiry?
I have a asp.net website where I am facing session timout issue. In web.config I have set session timeout=480 (8 hours as session time). But even then session do not stays that longer, session time goes out after some minutes. Kindly guide me why it is ? and how I can fix it. My site is hosted on a shared hosting server.
View 3 RepliesI am working on a web application which has 3 kinds of users.
To avoid multiple login of the same user I have used a signin column in the table which will become 1 after signin and 0 after signout. I have used session state to signout the user if he closes the browser window without signing out.
<system.web>
<sessionState mode="InProc" timeout="15" cookieName="student"/>
Global.asax :
void Session_End(object sender, EventArgs e)
{
int sid = Convert.ToInt32(Session["student"]);
candidate.signoutUser(sid);
}
But there are three kinds of users. I am not able to add multiple sessionState. Is there a way to solve this problem?
I am using session in my project,Be default session time is 20 minutes. How to increase the session time in web.config!!!!!1
View 3 Replieswhat should i write in web config file in asp.net so that my session time is extended. the exact location where should i place the code in web config
View 6 RepliesI thought about saving all sessions variables to hiddens and then resaving those values back into session after I changed the web config..but there has GOT to be another way.
View 1 Replieshow to write session timeout in web.config and after session time out i want to redirect to login page .
View 5 RepliesCan you use a session variable in a web config connection string? So instead of:
Code:
<add name="ConnectionString2" connectionString="Data Source=ora;Persist Security Info=True;User ID=SA;Password=PASS;Unicode=True"
something like this:
Code:
<add name="ConnectionString2" connectionString="Data Source=" & Session(DB) & ";Persist Security Info=True;User ID=SPAR;Password=;Unicode=True"
i set in web.config timeout session for 1 min.and after it expires i want it to move the user directly to the home page i have tried:
<!--// session timeout-->
<system.web>
<authentication mode="Forms">
[code]...
I have got a requirement to pass password and UseriD to web.config placed in a session variable . How can I do this?
in VB file it is written in this way. So, I have to pass it in Web.congif the Session variable.
dataSource.ConnectionString = "Provider=MSDAORA.1;Password=ssa_nic_" & Session("dist_code") & ";User ID=dise" & Session("dist_code") & ";Data Source=dise;Persist Security Info=True"
the following web.config file is placed in a specific sub-folder on a website. It will allow the user John.Doe to access the pages inside the folder but will deny anonymous users
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web> [code]...
Is it possible to replace users in the following web.config file with certain session variable for example getting the day(sunday, monday, etc) from date and storing it in session("DayVar")
then the code should be something like this for the subfolder monday
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web> [code]...
is this doable ?