Sharing session value between two different asp.net solutions using "SQL Server" mode -


i testing. created text box , button in first asp.net application , on button event stored value of text box in session got stored in database.

now created asp.net application text box. want call value of text box in first asp.net application.

how it?

i have read theoretical application. if write down code it, great help.

i have used

<mode="sqlserver" sqlconnectionstring="data source=.;integrated security=true"> 

in web.config.

i have created aspstate database in sql server 2008 r2.

protected void button1_click(object sender, eventargs e) { session["mydb"] = textbox1.text; } 

i storing value of textbox this. getting stored in database under table "aspstatetempsessions" in encrypted form in column sessionid.

now not getting how call value stored in database in text box in second web application.

i hope understand problem. please me!!

i have found solution:-

i changed procedure i.e.

use aspstate go  alter procedure dbo.tempgetappid     @appname tappname,     @appid int output      -- start change      -- use application name specified in connection appname if specified     -- allows share session between sites making sure have     -- same application name in connection string.     declare @connstrappname nvarchar(50)     set @connstrappname = app_name()      -- .net sqlclient data provider default application name .net apps     if (@connstrappname <> '.net sqlclient data provider')         set @appname = @connstrappname      -- end change  set @appname = lower(@appname) set @appid = null  select @appid = appid [aspstate].dbo.aspstatetempapplications appname = @appname  if @appid null begin begin tran   select @appid = appid [aspstate].dbo.aspstatetempapplications (tablockx) appname = @appname  if @appid null begin exec gethashcode @appname, @appid output  insert [aspstate].dbo.aspstatetempapplications values (@appid, @appname)  if @@error = 2627  begin declare @dupapp tappname  select @dupapp = rtrim(appname) [aspstate].dbo.aspstatetempapplications  appid = @appid  raiserror('sql session state fatal error: hash-code collision between applications ''%s'' , ''%s''. please rename 1st application resolve problem.',  18, 1, @appname, @dupapp) end end  commit end  return 0  go 

and web.config:-

<sessionstate mode="sqlserver" sqlconnectionstring="data source=.;integrated security=true;application name=test" cookieless="false" timeout="20"></sessionstate>    <httpruntime targetframework="4.5"/> 

you have add application name , have same application want share same session.

thanks.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -