Can someone tell me how can I get the url that was used to call my route when I am in the controller? It seems simple, but I cannot find any links on how to do this. If you need an example, I can explain more. I used to ask a question about a route, and someone told me how I can check which route was completed. This time my needs are a little different.
Thanks,
Mandy
Use the Url property of the Request object .
public ActionResult MyAction() { var url = Request.Url; /// ..... return View(); }
This will return a Uri object with everything you need .
You may also be interested in monitoring the RouteData property , which provides more detailed information about the route being analyzed.
Since you have a reference to the Request Controller property, you can simply do:
var url = Request.Url.ToString();
I would use the RouteData.Values โโproperty instead of the Request property. The Request property is likely to be null in the unit test script.
You can use the routing debugger to find out which URL matches your controller / actions.
Additional Information
Source: https://habr.com/ru/post/1345109/More articles:Rails3 or Express.js? who is more efficient during development? - ruby-on-railsTeamCity Notification Application for Linux? - linuxConvert string back to enumeration - enumsUnit testing of integrated service methods - javaC # DateTime.AddMonth with a day not existing next month - c #Silverlight Toolkit Timepicker is not visually displayed when using IsEnabled = False - silverlightHow to avoid comment indentation with vim cindent? - vimhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1345112/boostspirit-streamparser-consumes-too-much&usg=ALkJrhgoWfKyU0O4gIbtc2BP1nc0k5I-nAAny tool for debugging ActionScript ByteCode? Would like to watch registers, stacks - actionscript-3How to add two instances of the same object using Autofac? - autofacAll Articles