Can have connections external to my web.config - what about my SessionState?

  • Thread starter Thread starter Mufasa
  • Start date Start date
M

Mufasa

I need to store my session states in different places on my development
machine versus my production machine. How do I do that? I know you can do it
with connections and have already done that.

TIA - Jeff.
 
//web.config
<connectionStrings configSource="ExternalConnectionStrings.config" />



//ExternalConnectionStrings.config contents:

<connectionStrings >


<add name="InstanceOne" connectionString="server=.;database=MyDB;Integrated
Security=SSPI; Pooling=false; " providerName="System.Data.SqlClient"/>

</connectionStrings>




NOTE, for webforms, you do not have to add a POST BUILD EVENT, but for
winforms or console apps you will have to do a POST BUILD to copy the file
to the /bin/ directory. (or /bin/Debug/)
 
Sorry, I misread your post.


Is this what you're looking for:


<sessionState

mode="SQLServer"

cookieless="false"

timeout="20"

allowCustomSqlDatabase ="true"

sqlConnectionString ="Data Source=.;Initial Catalog=ASPState;Integrated
Security=SSPI;"

</sessionState>





You'll have to "make" a database (my name is ASPState here............
 
Here is a tip for creating the ASPState database:




(from command line prompt)(VS200x Command Line Prompt under Start /
Programs / etc..etc)

aspnet_regsql.exe -S . -E -ssadd -sstype p





After you do this .. you'll need to go in and add

MyMachine/ASPNET as a Sql Server LOGIN.

Set your default db to ASPState.
 
I've already created the database. It's that when I am debugging on my
machine, I want the session state stored in proc. When on the server I want
it stored in SQL.

Can I have an external file like with configurations?

J.
 
Back
Top