How can i get the url from where the error was originated and Application_Error was called inAsp.NET MVC C#, i have followed this link https://qawithexperts.com/questions/13/how-to-catch-all-error-in-c-mvc-error-handling , with the help of which i was able to catch all type of errors(404,500,any other) in MVC web-application but i am not able to get the original requested ur, because of which Application_Error was called.
How can i get the url, any idea?
please add this line in your Application_Error method of Global.asax , to get the URL of originals error
HttpContext con = HttpContext.Current;
var OriginalsErrorUrl =con.Request.Url.ToString();
this will resolve your problem for sure.
That's it, thank you
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly