在MVC 4.0中使用session和viewstate [英] Use of session and viewstate in MVC 4.0

查看:86
本文介绍了在MVC 4.0中使用session和viewstate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我对MVC 4.0中的会话和视图状态有一些疑问:

1.我们可以使用会话和视图MVC 4.0中的状态。

2.是否有更好的会话和视图状态替代方案。



谢谢和问候,

Ashish

Hi,

I have some queries regarding session and view state in MVC 4.0:
1. Can we use session and view state in MVC 4.0.
2. Is there any better alternative of session and view state.

Thanks & regards,
Ashish

推荐答案

你可以使用session,但MVC中没有视图状态。

有一个ViewData的概念和ViewBag,可用于跨请求传递数据 - 什么是ViewData,ViewBag和TempData? [< a href =http://www.codeproject.com/Articles/476967/WhatplusisplusViewData-cplusViewBagplusandplusTemtarget =_ blanktitle =New Window> ^ ]。
You can use session, but there is no view state in MVC.
There is a concept of ViewData and ViewBag that can be used to pass data across requests - What is ViewData, ViewBag and TempData?[^].


这篇关于在MVC 4.0中使用session和viewstate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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