为什么会话值不能进入asp.net的另一个页面? [英] why session value not get in another page in asp.net ?

查看:85
本文介绍了为什么会话值不能进入asp.net的另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai everyone

在我的网站上,在登录页面中我必须捕获会话变量中的ms访问数据库路径,在登录按钮中我获取数据库路径并存储在会话变量中。但是如果我在主页中使用,有时会话值不会传递到主页,它会给出错误,如没有错误消息,结果代码:DB_SEC_E_AUTH_FAILED(0x80040E4D)。





描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息:System.Data.OleDb.OleDbException:没有可用的错误消息,结果代码:DB_SEC_E_AUTH_FAILED(0x80040E4D)。



来源错误:





第1956行:cmd =新OleDbDataAdapter(新OleDbCommand(strcmd))

第1957行:cmd.SelectCommand.Connection = cn

第1958行:cn.Open()------->红色字体

1959行:cmd.Fill(dt)

1960行:cn.Close()





如果我在连接字符串中使用断点,则db路径(会话(dbpath))为空。



Hai everyone
In my web site,in login page i have to capture the ms access db path in session variable,in log in button i get the db path and store in session variable.but if i use in main pages ,sometime session value not pass to main pages and it gives error like "No error message available, result code: DB_SEC_E_AUTH_FAILED(0x80040E4D)."


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: No error message available, result code: DB_SEC_E_AUTH_FAILED(0x80040E4D).

Source Error:


Line 1956: cmd = New OleDbDataAdapter(New OleDbCommand(strcmd))
Line 1957: cmd.SelectCommand.Connection = cn
Line 1958: cn.Open()------->with red color font
Line 1959: cmd.Fill(dt)
Line 1960: cn.Close()


if i use break point in connection string db path (session("dbpath")) is empty.

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Session("dbpath") & "; Jet OLEDB:Database Password= password;")





请尽快回复

注意:有时它可以工作,如果不能再工作需要调试网站。



问候

Aravind



Pls reply asap
Note:Sometimes it work,if not work again need to debug the web site.

Regards
Aravind

推荐答案

这里没有任何混淆。您已经检查过并发现有时 session(dbpath)没有值,这就是您收到错误的原因。



首先,我不知道你为什么要像这样分配你的数据源。尝试直接应用数据源。或者在声明之前尝试检查会话是否为空(null)。



问候......:笑:
There is nothing like a confusion here. You have already checked and found that sometimes session("dbpath") doesnt have value and thats why you are getting error.

First of all,I dont know why you are assiging your datasource like this. Try applying the datasource directly. Or before the statement try to check if session is empty(null) or not.

Regards..:laugh:


这篇关于为什么会话值不能进入asp.net的另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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