为什么Request [“whatever”]返回cookie值?

问题描述 投票:1回答:1

据我所知:

Request.Form["whatever"]将返回表单中的值POST集合Request.QueryString["whatever"]将返回QueryString集合(或GET)中的值Request["whatever"]将返回POST集合(如果存在)或QueryString集合中的值,按此顺序

但是,我已经看到,如果有一个名为“whatever”的cookie,并且在POST或QueryString集合中找不到“what”的值,则将返回cookie值。

我错了,或者这实际上是ASP.Net MVC 5中的设计会发生什么?

asp.net-mvc cookies query-string form-post
1个回答
2
投票

来自docs

从Cookies,Form,QueryString或ServerVariables集合中获取指定的对象

所以是的,Request["whatever"]返回cookie值非常符合设计。

© www.soinside.com 2019 - 2024. All rights reserved.