how to get the Url of page which called Application_Error in ASP.NET

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 , 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?


Asked by:- jaya
: 4297 At:- 6/15/2017 12:53:41 PM MVC C# error

1 Answers
profileImage Answered by:- vikas_jk

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 


At:- 6/16/2017 7:26:58 AM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use