是否可以从代码中检测 ASP 会话状态类型?

发布于 2024-09-04 18:54:21 字数 320 浏览 1 评论 0原文

我正在尝试找出我们的测试环境中的问题。以前它被设置为使用 InProc 会话状态类型,但我已为一个特定的 Web 应用程序添加了 SQLServer 类型。我这样做是因为我们在生产环境中使用 SQLServer 类型,并且我希望我们的测试环境尽可能匹配。

但是,在将其更改为 SQLServer 后,当我尝试在会话中存储不可序列化的数据时,我不会收到任何错误,就像我所期望的那样。它工作得很好,尽管我认为它不应该。在配置方面我是一个相对新手,但从我用谷歌搜索的各种教程中,我认为我涵盖了所有基础知识。

我想知道是否有任何代码片段来验证应用程序正在主动使用哪种会话状态类型。

谢谢

I'm trying to track down a problem on our test environment. Previously it was set to use InProc Session State Type, but I've added in the SQLServer type for one specific Web App. I did this because we use the SQLServer type in our production environment and I want our test env to match as closely as possible.

However, after changing it to SQLServer I do not get any errors when trying to store unserializable data in session like I would expect. It works just fine, even though I would think it shouldn't. I'm a relative newbie when it comes to configuring this, but from the various tutorials I googled, I thought I covered all the bases.

I was wondering if there's any code snippets to verify which session state type an application is actively using.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Bonjour°[大白 2024-09-11 18:54:21

好的,通过访问找到它:

System.Web.SessionState.HttpSessionState.Mode  

还能够查看 ASPState 数据库中的表以查看添加/删除的会话。

显然,这只是我们正在使用的测试代码,我们希望打破它,但它的行为并不像我们预期的那样。

Ok, found it by accessing:

System.Web.SessionState.HttpSessionState.Mode  

Was also able to look at the tables in the ASPState database to see sessions being added/removed.

Apparently it was just the test code we were using that we expected to break that was not behaving as we expected..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文