asp.net mvc 地址栏传输信息报错:window.location.pathname
前端cshtml代码内容 代码片
.
// 页面跳转
window.location.pathname = '/Home/Index?cc=123';
“/”应用程序中的服务器错误
从客户端(?)中检测到有潜在危险的 Request.Path 值。
如何解决
- web.config中添加:不再出错,但是找不到界面
<httpRuntime targetFramework="4.8" requestPathInvalidCharacters="" />
- 最终解决
// 页面跳转
window.location= '/Home/Index?cc=123';
window.location.pathname理解:pathname 属性是一个可读可写的字符串,可设置或返回当前 URL 的路径部分。