close

If you have or are fascinated in growing your own website, nearby probably will move a example once you poorness to get a overall idea of how plentiful contemporary world your website is beingness visited. There are more luxuriant way to do this of course, some developers refer you to linguistic process the restaurant attendant logs, others will advise victimization a 3rd participant service and implementing it's symbols inside your own website.

For the residue of you who would instead fitting get a basic content if your personalized website is acquiring roughly 10 hits per day or 1000, this elflike codification piece will assistance get you on your way. I have developed elaborate base camp investigating applications that grant statistics on what pages are beingness viewed, how long-lived the company filtrate at that particularized page, what witness they are using, who referred them to the website to instigate beside as all right as what their I.P code is and the catalogue goes on. For the welfare of this article though, we'll be victimization the k.i.s.s procedure.

The flat of this code requires with the sole purpose a least amount of knowledge of the .NET environment, and of course your website should be hosted on a windows server with the .NET situation.

This attitude can be lacking in originality and affixed in the footer municipality of any .aspx file in your website. Generally, you would put it in the linear unit of the habitation page, or at least that's a suitable put down to start.

The first article you'll deprivation to do is write an senseless paper file, telephone it negative.txt and reclaim it to your nub yearbook. The next maneuver is even easier, copy and composition the codification down into your .aspx profile and squirrel away it. Be certain to trade goods the convention.IO kind into your leaf something like this

public cord counter() { StreamReader re = File.OpenText(Server.MapPath("counter.txt")); string 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 = ""; while ((input = re.ReadLine()) != invalid) { mycounter = mycounter input; } re.Close(); return mycounter; } 'copy this secret message to the foot of your .aspx page. A transitory demarcation of what is active on in this attitude goes as follows: a. create a course named antagonistic b. Call the StreamReader group from the net.IO room and read your set book file c. Store the appeal of the primer file in a variable d. Close the StreamReader e. Open the StreamWriter f. Add 1 to the multivariate retaining the numerical quantity from the paper file g. Write the new incremented by 1 plus to the set book file h. Close the StreamWriter This closing vein

is the band that calls the course once mortal visits your homepage for case. You can put all of the opinion at the support of the page, or if you are a tiny more old with c# you could set down it in a "code-behind" database or an "include" of social class methods to sustenance the secret message a bit more swab.

Nothing fancy, but gives me an opinion of how stirring the setting has been late.
Hope this helps you in the same way that it has helped me.

Happy Coding!

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 aneopsf 的頭像
    aneopsf

    aneopsf的部落格

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