我可以测试查询字符串参数:
Request.QueryString["value"].IsEmpty()
Request.QueryString["value"].Isint()
Etc.
但是我怎样才能避免根本没有查询字符串呢?换句话说,我希望prevent
用户访问the root
每个文件夹或子文件夹。
http://localhost:16838/auth/provider.cshtml
instead of:
http://localhost:16838/auth/provider.cshtml?providerId=7
如果我删除查询字符串(直到页面扩展名),我会收到cannot perform runtime binding on a null reference
错误,因为代码的下一部分仍在执行。
相反,我希望用户redirect
成为400 BAD REQUEST
:
The request could not be understood by the server due to malformed syntax.
The client SHOULD NOT repeat the request without modifications