开发者

HttpSessionState null using CassiniDev

开发者 https://www.devze.com 2023-03-31 21:25 出处:网络
I am trying to build some unit test using CassiniDev. First of all I create a Server and a Page and generate a request:

I am trying to build some unit test using CassiniDev. First of all I create a Server and a Page and generate a request:

CassiniDevServer server = new CassiniDevServer();
server.StartServer("C:\\", 8080, "/", "localhost");
File.Delete(@"C:\Default.aspx");
File.Create(@"C:\Default.aspx");
WebClient browser = new WebClient();
browser.DownloadString(server.NormalizeUrl("Default.aspx"));

Everything is fine, but when I try to use the HttpSessionState object, it is null:

session = HttpContext.Current.Session;开发者_运维知识库

Should I do something else or additional steps?

0

精彩评论

暂无评论...
验证码 换一张
取 消