如何清除NameValue集合发布的值,Request.Form [" Key"] [英] How to Clear NameValue collection posted values , Request.Form["Key"]
问题描述
我使用Page.Post方法使用Namevaluecollection将值发布到另一个页面
来自目标页面我正在检索值为Request.Form [Key ]
检索后我无法清除那些项目。
Request.Form.Clear()将错误视为只读,因此我只得到以前的值每个新请求
请向我建议明确值
< br $> b $ b
谢谢。
试试这个
[HttpPost]
public ActionResult Create(FormCollection collection)
{
try
{
string value = collection [0] ;
//放一个debuge看价值
collection.Clear();
string value2 = collection [0];
//再看清楚
后的值2 ---------------------------------- -----------------------
如果你想根据类型删除servervariables数据使用这个一个
I have used Page.Post Method to post values to another page using Namevaluecollection
from the destination page i am retrieving values as Request.Form["Key"]
after retrieving i am unable to clear that items.
Request.Form.Clear() giving error as read only , because of this i am getting previous values only for every new request
please suggest to me clear values
Thank you .
Try this one
[HttpPost] public ActionResult Create(FormCollection collection) { try { string value = collection[0]; //Put a debuge see the value collection.Clear(); string value2 = collection[0]; //Again see the value 2after clear ---------------------------------------------------------
If you want to delete servervariables data according to type use this one
这篇关于如何清除NameValue集合发布的值,Request.Form [" Key"]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!