Execute some code for each request for ASP.NET

issueneFienia

New Member
Is there a way to write some code that would be executed for each request to a .aspx or a .cshtml page in asp.net 4.5 apart from using a base page class. it is a very huge project and making changes to all pages to use a base page is a nightmare. Also i am not sure how would this be done for a cshtml page since they don't have a class.Can we use the Application_BeginRequest and target only the aspx and cshtml files since the website is running in integrated mode.?basically, i have to check if a user who is accessing the website has a specific ip address against a database and if yes then allow access otherwise redirect.we are using IIS8 and ASP.Net 4.5 and ASP.Net Razor Web Pages
 
Back
Top