Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

c# - Custom SessionState Oracle SessionStateStoreProviderBase

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

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

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.

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>

Error Log 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

Exception in the controller:

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

Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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

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

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

Thanks for your help and attention.

Thank 'Alireza'! :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...