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

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.
 
S

sloan

//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/)
 
S

sloan

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............
 
S

sloan

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.
 
M

Mufasa

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top