Jump to content

how to retrieve no of visits for the page


aadimalli

Recommended Posts

If you decide to build your own, an easy way to implement this in .NET is to handle it in the Application_BeginRequest event handler in the Global.asax.cs (or Global.asax.vb if you're using VB) file.

using System.Web;public class Global : HttpApplication{	protected void Application_BeginRequest(Object sender, EventArgs e)	{   // This method runs as soon as a request is sent to the web server for		// any resource in your .NET website.  You can get the path to the file here.		string path = HttpContext.Current.Request.Url.AbsolutePath;		// "path" will now store the file name for your page.  This is where		// you could put the code to increment a counter that keeps track of		// how many times the page has been loaded.  This data could be		// stored in a database or in a file on the server's hard drive.		// Once all the code in here executes, the request gets sent on its		// merry way.	}}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...