有人可以给我一个例子或链接到在asp.net mvc中使用会话之一吗?asp.net mvc session example
3
A
回答
10
与WebForms中的相同:
使用HttpContext.Current.Session对象。
HttpContext.Current.Session["UserName"] = "Jon";
string userName = HttpContext.Current.Session["UserName"];
+0
您提前10秒发布! ^^ – 2009-07-29 11:37:12
0
随着MVC Future库是可以做到的要简单得多
在Global.asax.cs
添加一行在Application_Start()
方法
ValueProviderFactories.Factories.Add(new SessionValueProviderFactory());
然后你就可以在控制器通过
$Session["YourName"] = "some value";
访问会话或在查看
@Session["YourName"]
here is article到你的项目
相关问题
- 1. Google AppEngine Session Example
- 2. Asp.Net MVC和Session
- 3. ASP.NET MVC Session
- 4. ASP.NET MVC 3 Session
- 5. ASP.Net MVC Nhibernate Session
- 6. asp.net mvc session
- 7. ASP.NET MVC 5和Session
- 8. Asp.Net mvc Session Vs Cache
- 9. ASP.NET Session
- 10. ASP.NET Session Recycles
- 11. asp.net session dissappers
- 12. mvc 3 session and authorizeAttribute
- 13. Session asp.net info not changing
- 14. ASP.NET Session TimeOut问题
- 15. Request is still authenticated but Session [“account”] was lost in Asp.net MVC
- 16. 在asp.net mvc中设置Session的持久性cookie过期?
- 17. 转换Session对象强类型对象在asp.net mvc的
- 18. ASP.NET MVC从控制器传递信息,无需ViewData,ViewModel或Session
- 19. Asp.net-MVC中的Session和ViewData有什么区别?
- 20. ASP.net MVC 5 Session在调用Abandon之后未清除()
- 21. 在ASP.NET MVC 3中使用Unity存储在Session中的对象
- 22. Nhibernate Session关闭异常问题与Asp.net mvc telerik ajax网格
- 23. Asp.Net中Session的问题
- 24. rss feed android example
- 25. Javascript Promise/Then Example
- 26. webview shouldinterceptrequest example
- 27. ajax aspx example
- 28. NSIndexSet indexPassingTest example
- 29. Renderscript Carousel Example
- 30. twisted.web.resource.Resource with twisted.web.template.Element example
我想它的工作原理就像在web表单如何添加库。 – 2009-07-29 11:36:07