0 Replies - 1809 Views - Last Post: 11 November 2012 - 10:04 AM Rate Topic: -----

#1 sAttc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-November 12

Sharing session state using web.config not reflection

Posted 11 November 2012 - 10:04 AM

I'm sharing session variables in two different asp.net web applications.

I'm using "StateServer" mode.

For sharing, i set _appDomainAppId of the HttpRuntime same for applications with using reflection. In Application_Start function, here is my code:

string applicationName = "mysite"

            FieldInfo runtimeInfo = typeof(HttpRuntime).GetField("_theRuntime",
                BindingFlags.Static | BindingFlags.NonPublic);
            HttpRuntime theRuntime = (HttpRuntime)runtimeInfo.GetValue(null);
            FieldInfo appNameInfo = typeof(HttpRuntime).GetField("_appDomainAppId",
                BindingFlags.Instance | BindingFlags.NonPublic);
            appNameInfo.SetValue(theRuntime, applicationName);


Here is my question : I don't want to use reflection for this. I want to handle this in web.config.

Is there any way to set _appDomainAppId in web.config ? I couldn't find anything under the httpRuntime section or anywhere else.

Thank you.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1