自定义SessionState Oracle SessionStateStoreProviderBase [英] Custom SessionState Oracle SessionStateStoreProviderBase

查看:220
本文介绍了自定义SessionState Oracle SessionStateStoreProviderBase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 自定义会话类 ,并继承了

I created a custom session class and inherited the SessionStateStoreProviderBase connecting the oracle.

我正在使用此操作方法,只需替换为 Oracle.DataAccess .

I'm using this how-to, just replace with the connection classes of Oracle.DataAccess.

直到那时一切都在本地工作,但是当我使用自定义类SessionStateStoreProviderBase在iis 7.5服务器上发布时,仍在工作,但是变量"

Until then everything working locally but when I publish on iis 7.5 server with a custom class SessionStateStoreProviderBase is still working, but the variable "session" (HttpSessionStateBase) are zero (null). Ex: Session["idUser"]. Anything I'm forgetting? Please I need help, because the documentation does not seem to be clear about that.

我的web.config:

My web.config:

   <sessionState timeout="30" mode="Custom" cookieless="false" customProvider="CustomSessionProvider" sessionIDManagerType="namespace.CustomSessionIdManager">
      <providers>
        <add name="CustomSessionProvider" type="namespace.SessionDataProvider" connectionStringName="connectionOracle" />
      </providers>
    </sessionState>
    <authentication mode="Forms">
      <forms loginUrl="~/Login" defaultUrl="~/Inicio" />
    </authentication>

错误日志IIS:

#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2014-08-05 01:14:37
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
2014-08-05 01:14:37 192.168.xxx.xx GET / - 80 - 10.100.xxx.xx Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/34.0.1847.131+Safari/537.36 302 0 0 6239
2014-08-05 01:14:37 192.168.xxx.xx GET /Inicio - 80 - 10.100.xxx.xx Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/34.0.1847.131+Safari/537.36 500 0 0 374

控制器中的异常:

对象引用未设置为对象的实例 在会话为空之前先进行验证.

object reference not set to an instance of an object Verify before if session is null.

谢谢.

推荐答案

调试我最好的自定义类会话时,我注意到在尝试转换整数时,他接受了异常,但它在localhost上有效,但在服务器上不起作用.通过进行另一种类型的转换来解决问题,转换而不是 GetInt32 odt Oracle. 不知道为什么它起作用了,但是在服务器上却不起作用,并且重现了相同的情况.

Debugging my best custom class session, I noticed that when trying to convert an integer he took exception, but it worked localhost, but not on the server. Skirted the problem by making another type of conversion, Convert using the framework rather than the GetInt32 odt Oracle. Do not know why so it functioned, but not on the server, and reproduce the same situation.

由于这个错误,他没有到达方法'CreateNewStoreData'.

With this error he did not arrive in the method 'CreateNewStoreData'.

效果很好.例如:reader.IsDBNull(2)? 0:Convert.ToInt32(阅读器 2 );

Works well. Ex: reader.IsDBNull(2) ? 0 : Convert.ToInt32(reader2);

效果不佳.例如:reader.IsDBNull(2)? 0:reader.GetInt32(2);

Does not work well. Ex: reader.IsDBNull(2) ? 0 : reader.GetInt32(2);

感谢您的帮助和关注.

感谢" Alireza "! :)

这篇关于自定义SessionState Oracle SessionStateStoreProviderBase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆