1

I have a need to get everything after "/proxy" in my web application. Here are some example URLS:

/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

How do I get everything after "/proxy"? I tried doing this:

[Route("proxy/*")]
public string Get() {
  // do stuff with request here..
}

But that didn't work. It's like the "*" isn't being honored.

Paul Fryer
  • 9,268
  • 14
  • 61
  • 93

1 Answers1

2

Try adding a argument to take the value after proxy. The QueryString will not be part of the route. For sample:

[Route("proxy/{*argument}")]
public string Get(string argument) 
{
   // code
}

Make sure you have setted the * to take everything.

Felipe Oriani
  • 37,948
  • 19
  • 131
  • 194
  • But that starts to fall apart when the stuff following "/proxy" contains "/" slashes, like the first example URL in the question. – Paul Fryer Jan 21 '16 at 21:21
  • That works for the first 2 URLs in my example, but I just added a 3rd one that contains a period "." and that isn't matching the pattern. – Paul Fryer Jan 21 '16 at 22:29
  • Maybe it is a MVC issue, take a look at it and see how many different ways you can solve it http://stackoverflow.com/questions/11728846/dots-in-url-causes-404-with-asp-net-mvc-and-iis – Felipe Oriani Jan 21 '16 at 22:32
  • 1
    Yep that SO link you provided (along with the pattern you suggested) did seem to do the trick. Thanks Felipe! – Paul Fryer Jan 21 '16 at 22:48