1
我在两个不同的asp.net web应用程序中共享会话变量。使用web.config共享会话状态不反射
我正在使用“StateServer”模式。
对于共享,我设置_appDomainAppId的的httpRuntime相同的用于使用反射的应用程序。在的Application_Start功能,这里是我的代码:
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);
这里是我的问题:我不想使用反射此。我想在web.config中处理这个。
有什么办法可以在web.config中设置_appDomainAppId?我在httpRuntime部分或其他地方找不到任何东西。
谢谢。