C
C#3y ago
Pokey

❔ Convert relative URI string to route

Is it possible to take a relative URI string, for example /Api/RetrieveById/1?search=hello and split it into: Controller: Api Action: RetrieveById RouteValues: id = 1, Search = "hello"
3 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Pokey
PokeyOP3y ago
@Divi Thanks Ultimately, I ended up doing this:
string? returnUrl = httpContext.Request.Path.ToUriComponent();
string queryString = httpContext.Request.QueryString.ToUriComponent();

if (!string.IsNullOrWhiteSpace(returnUrl) && !string.IsNullOrWhiteSpace(queryString)) returnUrl += queryString;
string? returnUrl = httpContext.Request.Path.ToUriComponent();
string queryString = httpContext.Request.QueryString.ToUriComponent();

if (!string.IsNullOrWhiteSpace(returnUrl) && !string.IsNullOrWhiteSpace(queryString)) returnUrl += queryString;
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server