会话数据失败 [英] Session Data Failing

查看:86
本文介绍了会话数据失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已尽力寻找该问题的答案,如果我错过了一篇帖子,而这是一次偶然的转发,请告诉我.我有一个基于VB的Web应用程序,该应用程序似乎无法捕获会话数据.长话短说,该应用程序从中收集数据 内部用户,然后通过电子邮件向他们发送链接以确认其信息.因此,他们点击链接"ourserver.local/confirmdata.aspx?verifid =" UserGUID",当然,用户guid将替换为SQL Server为其生成的任何内容 报名.所以我发现这是在两个地方,即vb代码或SQL服务器(我的钱在vb代码上).

I have done my best to search out an answer to this issue, if I missed a post and this is accidentally a repost please let me know. I have a web app based in VB that cannot seem to capture the session data. So long story short the app collects data from an internal user and then emails them a link to confirm their information. So they click the link "ourserver.local/confirmdata.aspx?verifid="UserGUID" and of course the user guid is replaced with whatever the SQL server generates for them on sign up. So I figured this is in two places, the vb code or the SQL server (my money is on vb code).

对我来说,页面代​​码只是一个简单的脚本,可以触发存储的proc并返回其输出的数据:

The Page code to me is just a simple script to fire off a stored proc and return the data it outputs:

​
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim conn As New SqlClient.SqlConnection
Dim cmd As New SqlClient.SqlCommand
Dim connString As String = GlobalConnections.productionSQLserver
Dim confid As String = Session("verifid")
Dim agent As String = Request.UserAgent
conn = New SqlClient.SqlConnection(connString)
cmd = New SqlClient.SqlCommand
conn.Open()
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spConfirmData"
cmd.Parameters.AddWithValue("@verificationguid", confid)
cmd.Parameters.AddWithValue("@uagent", agent)
cmd.Parameters.Add("@first", SqlDbType.VarChar, 255)
cmd.Parameters("@first").Direction = ParameterDirection.Output
cmd.Parameters.Add("@last", SqlDbType.VarChar, 255)
cmd.Parameters("@last").Direction = ParameterDirection.Output
cmd.Parameters.Add("@eid", SqlDbType.VarChar, 255)
cmd.Parameters("@eid").Direction = ParameterDirection.Output
cmd.Parameters.Add("@email", SqlDbType.VarChar, 255)
cmd.Parameters("@email").Direction = ParameterDirection.Output
cmd.Parameters.Add("@retmessage", SqlDbType.VarChar, 255)
cmd.Parameters("@retmessage").Direction = ParameterDirection.Output
cmd.Parameters.Add("@retcode", SqlDbType.Int)
cmd.Parameters("@retcode").Direction = ParameterDirection.Output
cmd.ExecuteNonQuery()
Label1.Text = confid
fnameconf.Text = cmd.Parameters("@first").Value.ToString
lnamelbl.Text = cmd.Parameters("@last").Value.ToString
employeeid.Text = cmd.Parameters("@eid").Value.ToString
emailaddress.Text = cmd.Parameters("@email").Value.ToString
conn.Close()
End Sub

因此,如果我点击其中一封验证电子邮件链接,则会看到您看到的标签1到底部负载为标签",在页面上,存储的proc在SQL端触发,并显示@verificationguid = default的参数.我当然会收到错误 从VS2015声明:

So if I click one of the verification email links the Label1 you see towards to bottom loads as "Label" on the page, the stored proc fires off on the SQL side and it shows the parameter of @verificationguid = default. The of course I get the error from VS2015 stating:

" System.Data.dll中发生类型'System.Data.SqlClient.SqlException的异常,但未在用户代码中处理.其他信息:过程或函数'spConfirmData'期望参数'@verificationguid',没有提供."

"An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code Additional information: Procedure or function 'spConfirmData' expects parameter '@verificationguid', which was not supplied."

所以我知道我在某个地方编码错误,只是不确定在哪里.关于我可能在哪里出现问题的任何建议?

So I know I have coded something wrong somewhere, I am just not sure where. Any suggestions as to where I might have an issue?

谢谢

Jon

推荐答案

,当然,用户guid将替换为注册时SQL Server为他们生成的任何内容.

and of course the user guid is replaced with whatever the SQL server generates for them on sign up.

这毫无意义,而且对于您采用这种逻辑的方式值得怀疑.

It makes no sense, and it is questionable as to how you came with this logic.

所以我知道我在某处编码有误,只是不确定在哪里.关于我可能在哪里出现问题的任何建议?

应该在用户的VB代码中创建GUID,然后将GUID和有关用户的其他数据保存到SQL Server DB记录中.

The  GUID should be created in the VB code for the user, and then the GUID and other data about the user is persisted to the SQL Server DB record.


这篇关于会话数据失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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