My requirement is to catch all the requests coming into my MVC website. It should behave like Fiddler. So lets suppose I am loading 4 JS files and 4 Image files, then the total number of requests which I need to catch is 9(1 for view/action, 4 JS, 4 image).
Asked
Active
Viewed 269 times
0
-
*My requirement is to catch all the requests coming into my MVC website* restricted to the app only? perhaps you can try [`HttpModule`](https://msdn.microsoft.com/library/ms178468(v=vs.85).aspx).. look at [this answer](https://stackoverflow.com/a/11508232/4648586) for some comparison about it against ActionFilter. – Bagus Tesa May 24 '18 at 03:40
1 Answers
0
You can catch and count it in Global.asax.cs
protected void Application_BeginRequest()
{
SystemReporter.NewRequest();
}
public static class SystemReporter
{
static int requestCounter;
public static void NewRequest()
{
requestCounter++;
//save it to database
//And other logic for manipulation
}
}

Saurin Vala
- 1,898
- 1
- 17
- 23
-
With this I am able to capture the request hits but how will I also capture the JS file as well as Image file requests which are also GetRequest from the page – Ujjwal Sharma May 24 '18 at 18:52