复制代码 代码如下:
USE [ASPState]
GO
/****** Object: StoredProcedure [dbo].[TempGetAppID] Script Date: 11/21/2011 16:15:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [dbo].[TempGetAppID]
@appName tAppName,
@appId int OUTPUT
AS
SET @appName = LOWER(@appName)
SET @appId = NULL
set @appId=640732509 --这个是我自己测试时写死的 你可以通过系统数据库tempdb中的ASPStateTempApplications查询到站点appId 记住只有当网站的Seeion配置是数据库中 而且保存过一次Session值才能查询的到
/*
--SELECT @appId = AppId
--FROM [tempdb].dbo.ASPStateTempApplications
--WHERE AppName = @appName
以上注释办法为原来ASP.net 自动生成的
*/
IF @appId IS NULL BEGIN
BEGIN TRAN
SELECT @appId = AppId
FROM [tempdb].dbo.ASPStateTempApplications WITH (TABLOCKX)
WHERE AppName = @appName
IF @appId IS NULL
BEGIN
EXEC GetHashCode @appName, @appId OUTPUT
INSERT [tempdb].dbo.ASPStateTempApplications
VALUES
(@appId, @appName)
IF @@ERROR = 2627
BEGIN
DECLARE @dupApp tAppName
SELECT @dupApp = RTRIM(AppName)
FROM [tempdb].dbo.ASPStateTempApplications
WHERE AppId = @appId
RAISERROR('SQL session state fatal error: hash-code collision between applications ''%s'' and ''%s''. Please rename the 1st application to resolve the problem.',
18, 1, @appName, @dupApp)
END
END
COMMIT
END
RETURN 0
复制代码 代码如下:
SessionIDManager sessionid = new SessionIDManager();
bool a;
bool b;
sessionid.SaveSessionID(this.Context, "这里是SeeionID", out a, out b);
新闻热点
疑难解答
图片精选