sqlstateserver appid vb.net

sqlstateserver appid vb.net(sqlstateserver appid vb.net)
本文介绍了sqlstateserver appid vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚如何获取和分离 sql​​server 为 stateserver 返回的 appid 和 sessionid.我需要在我的 web 应用程序中获取此信息,但除了读取信息之外,我无法访问 sqlserver.

Im trying to figure out how to get and separate the appid and the sessionid that gets returned by sqlserver for stateserver. I need to get this info in my webapp and i do not have access to the sqlserver other than to read the information.

在文档中:奇怪的是,ASPStateTempSessions 表缺少将其链接到 ASPTempStateApplications 的 AppId 列.链接发生在 ASPStateTempSessions 的 SessionId 字段中,该字段不仅仅存储会话 ID.它存储附加了应用程序 ID 的会话 ID.声明

in the docs:Curiously, the ASPStateTempSessions table lacks an AppId column linking it to ASPTempStateApplications. The linkage occurs in ASPStateTempSessions's SessionId field, which doesn't store just session IDs. It stores session IDs with application IDs appended to them. The statement

cmd.Parameters[0].Value = id + _partitionInfo.AppSuffix

所以我在 AspStateTempApplications 表中有这个值:

so i have this value in the AspStateTempApplications table:

    appid            appname
    -796116323     /w3svc/*/root/fsco*tbsc 

我已经在会话表中确定了我的会话信息与转换后的 appid 吗?

i have identified in the session table my session info with the appid converted?

sessionid
cp5p2trw5navwnsgmhdzctnn2341447f 

后面的部分:2341447f 应该对应于 -796116323 但如果我运行一个十六进制转换函数,它要么在负号上显示 barfs,要么使用在线转换器给我错误的值.我怎样才能得到那个值,我想查询会话值

the portion at the back: 2341447f should correspond to -796116323 but if i run a hexadecimal convert function it either barfs on the negative sign or using online converters gives me the wrong value. how can i get that value, i would like to query session values

我在这里遗漏了什么......看起来很简单

what am i missing here.. it seems straightforward

推荐答案

可以使用

SUBSTRING(a.SessionId, 25, 8) AS AppIDHex, 

并将 AppId 转换为 HEX

and convert AppId to HEX

SUBSTRING(sys.fn_varbintohexstr(CONVERT(VarBinary,b.AppId)), 3, 8) 

SQL 代码:

  SELECT 
    a.SessionId, 
    SUBSTRING(a.SessionId, 25, 8) AS AppIDHex, 
    b.AppId AS AppIDDec, 
    b.AppName, 
    DATALENGTH(a.SessionItemLong) AS SessionSize 
FROM 
    dbo.ASPStateTempSessions AS a 
    LEFT OUTER JOIN 
    dbo.ASPStateTempApplications AS b 
    ON 
    SUBSTRING(a.SessionId, 25, 8) = 
    SUBSTRING(sys.fn_varbintohexstr(CONVERT(VarBinary,b.AppId)), 3, 8) 

https://blogs.msdn.microsoft.com/rextang/2008/01/12/asp-net-checking-session-size-in-sql-server-aspstate-db/

这篇关于sqlstateserver appid vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)