【小5聊】C#基础之Ajax的get、post与Request.Form的判断

直接使用$.get()和$.post()方法调用时,如果C#通过Request.Form获取值,会出现异常

1、Incorrect Content-Type: 

不正确的内容类型:

2、解决方案

通过Content-Type来判断,如果没有值,则不获取Form 

if (Request != null && Request.ContentType != null)

猜你喜欢

转载自blog.csdn.net/lmy_520/article/details/121684520
今日推荐