HttpContext.Request.Form 有值,分配给变量时为 null
我不知所措。我们有一个处理来自客户端操作的回调的类
jQuery.ajax({data: data, error: null, success: null, type: "POST", dataType: 'json', url: "/mylogger.axd"});.
,我将 HttpContext.Request.Form 分配给一个变量。尽管它是非空的,并且具有我期望的所有参数,但我分配给它的变量是空的。
public class MyLogger : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
NameValueCollection formParams = context.Request.Form;
if (formParams == null)
{ ...
如果我将 Visual Studio 附加到进程,当它被触发时, context.Request.Form 肯定有一个值:
{response=http%3a%2f%2fXXX.XXXcom%2fproduct%2f12345%2f13528311&event=MYEVENT&objid=13528311&objtype=2} System.Collections.Specialized.NameObjectCollectionBase {System.Web.HttpValueCollection}
然而, formParams 为 null。
啊?一般来说,是否有任何原因导致该值不会被复制到变量中?
I am at a loss. We have a class that handles callbacks from client-side actions
jQuery.ajax({data: data, error: null, success: null, type: "POST", dataType: 'json', url: "/mylogger.axd"});.
I assign HttpContext.Request.Form to a variable. Though it is non-null, and has all the parameters I expect, the variable I assigned it to is null.
public class MyLogger : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
NameValueCollection formParams = context.Request.Form;
if (formParams == null)
{ ...
If I attach Visual Studio to the process, when this gets fired, context.Request.Form definitely has a value:
{response=http%3a%2f%2fXXX.XXXcom%2fproduct%2f12345%2f13528311&event=MYEVENT&objid=13528311&objtype=2} System.Collections.Specialized.NameObjectCollectionBase {System.Web.HttpValueCollection}
And yet, formParams is null.
Huh? In general, is there any reason why the value wouldn't be copied into the variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论