如何获取 MVC 或 WebAPI 控制器中的所有路径和查询字符串?
How to get all path and query string in MVC or WebAPI Controllers?
我需要在我的 Web 应用程序中获取“/proxy”之后的所有内容。以下是一些示例 URL:
/proxy/HU91r//www.dde3.xhyzlkejkeje.3322.es/es/px
/proxy/7ZROK?si=0&e=http%3A%2F%2Fsecdd-uat.clsssapp
/proxy/someapp.js?_t=something&_r=bla.html&_a=s&_n=39393
如何获取“/proxy”之后的所有内容?
我试过这样做:
[Route("proxy/*")]
public string Get() {
// do stuff with request here..
}
但这没有用。就像“*
”没有被兑现一样。
尝试添加一个参数以获取代理后的值。 QueryString 不会成为路由的一部分。例如:
[Route("proxy/{*argument}")]
public string Get(string argument)
{
// code
}
确保您已将 *
设置为获取所有内容。
我需要在我的 Web 应用程序中获取“/proxy”之后的所有内容。以下是一些示例 URL:
/proxy/HU91r//www.dde3.xhyzlkejkeje.3322.es/es/px
/proxy/7ZROK?si=0&e=http%3A%2F%2Fsecdd-uat.clsssapp
/proxy/someapp.js?_t=something&_r=bla.html&_a=s&_n=39393
如何获取“/proxy”之后的所有内容? 我试过这样做:
[Route("proxy/*")]
public string Get() {
// do stuff with request here..
}
但这没有用。就像“*
”没有被兑现一样。
尝试添加一个参数以获取代理后的值。 QueryString 不会成为路由的一部分。例如:
[Route("proxy/{*argument}")]
public string Get(string argument)
{
// code
}
确保您已将 *
设置为获取所有内容。