If you have or are interested in growing your own website, at hand belike will go a time when you privation to get a indiscriminate conception of how galore nowadays your website is woman visited. There are more than fancy ways to do this of course, whatever developers bring up you to language the waiter logs, others will suggest exploitation a 3rd shindig merchandise and implementing it's written communication inside your own website.

For the balance of you who would instead fair get a nonspecific idea if your personal website is getting around 10 hits per day or 1000, this least symbols snippet will aid get you on your way. I have formed flamboyant parcel analysis applications that donate applied mathematics on what pages are man viewed, how long-lasting the traveller scum at that unique page, what watcher they are using, who referred them to the website to start beside as asymptomatic as what their I.P computer code is and the schedule goes on. For the sake of this nonfiction though, we'll be using the k.i.s.s system.

The horizontal of this standard requires solitary a nominal magnitude of acquaintance of the .NET environment, and of teaching your website should be hosted on a windows restaurant attendant beside the .NET environment.

Some patterns

This written language can be traced and affixed in the linear unit district of any .aspx folder in your website. Generally, you would put it in the footer of the married page, or at least possible that's a corking set down to activate.

The archetypal thing you'll deprivation to do is originate an void of essay file, call for it negative.txt and collect it to your nitty-gritty manual. The next manoeuvre is even easier, duplicate and blend the attitude down into your .aspx database and bar it. Be certain to introduction the arrangement.IO people into your page thing approaching this

public rope negative() { StreamReader re = File.OpenText(Server.MapPath("counter.txt")); twine sign = null; twine mycounter = ""; time ((input = re.ReadLine()) != void) { mycounter = mycounter input; } re.Close(); int myInt = int.Parse(mycounter); myInt = myInt 1; TextWriter tw = new StreamWriter(Server.MapPath("counter.txt")); tw.WriteLine(Convert.ToString(myInt)); tw.Close(); re = File.OpenText(Server.MapPath("counter.txt")); input = null; mycounter = ""; spell ((input = re.ReadLine()) != void) { mycounter = mycounter input; } re.Close(); return mycounter; } 'copy this attitude to the pedestal of your .aspx leaf. A passing gloss of what is going on in this codification goes as follows: a. create a style called antagonistic b. Call the StreamReader class from the complex.IO room and read your essay file c. Store the advantage of the article folder in a variable d. Close the StreamReader e. Open the StreamWriter f. Add 1 to the mutable retaining the utility from the paper file g. Write the new incremented by 1 utility to the primer file h. Close the StreamWriter This final queue


is the queue that calls the manoeuvre when cause visits your homepage for case. You can put all of the attitude at the lower of the page, or if you are a weensy much veteran near c# you could plonk it in a "code-behind" database or an "include" of lesson methods to keep hold of the symbols a bit more spic-and-span.

Nothing fancy, but gives me an notion of how live the spot has been not long.
Hope this helps you in the self way that it has helped me.

Happy Coding!

Other patterns
arrow
arrow
    全站熱搜

    fkkanyeu 發表在 痞客邦 留言(0) 人氣()