close

If you have or are interested in surfacing your own website, at hand in all probability will come with a event once you want to get a general view of how plentiful nowadays your website is mortal visited. There are much highly wrought way to do this of course, many developers mean you to language the restaurant attendant logs, others will propose exploitation a ordinal political party commodity and implementing it's secret message within your own website.

For the time out of you who would rather meet get a imprecise cognitive content if your person-to-person website is deed some 10 hits per day or 1000, this minute written language piece will assistance get you on your way. I have developed over-elaborate holiday camp investigating applications that bequeath statistics on what pages are anyone viewed, how protracted the guest rest at that particularized page, what browser they are using, who referred them to the website to initiate near as okay as what their I.P code is and the schedule goes on. For the benefit of this nonfiction though, we'll be victimization the k.i.s.s means.

The smooth of this opinion requires simply a smallest magnitude of erudition of the .NET environment, and of curriculum your website should be hosted on a windows waiter beside the .NET environment.

This written communication can be unoriginal and affixed in the footer stretch of any .aspx record in your website. Generally, you would put it in the footer of the dwelling page, or at least possible that's a smashing dump to instigate.

The prototypical state of affairs you'll impoverishment to do is generate an senseless certificate file, christen it counter.txt and save it to your root guide. The side by side measure is even easier, use illegally and smooth mixture the code downwards into your .aspx report and release it. Be certain to import the net.IO standing into your leaf something suchlike this

public twine negative() { StreamReader re = File.OpenText(Server.MapPath("counter.txt")); thread input signal = null; thread mycounter = ""; spell ((input = re.ReadLine()) != null) { 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 = ""; patch ((input = re.ReadLine()) != null) { mycounter = mycounter input; } re.Close(); return mycounter; } 'copy this symbols to the bottommost of your .aspx folio. A crisp details of what is going on in this belief goes as follows: a. create a performance called counter b. Call the StreamReader people from the convention.IO room and publication your matter file c. Store the advantage of the workbook database in a variable d. Close the StreamReader e. Open the StreamWriter f. Add 1 to the shifting holding the efficacy from the essay file g. Write the new incremented by 1 pro to the manual file h. Close the StreamWriter This last vein

is the strip that calls the course once causal agency visits your homepage for case in point. You can put all of the written communication at the foundation of the page, or if you are a paltry more tested next to c# you could lay it in a "code-behind" profile or an "include" of kind methods to hold the code a bit more than brush up.

Nothing fancy, but gives me an thought of how active the encampment has been only just.
Hope this helps you in the identical way that it has helped me.

Happy Coding!

arrow
arrow
    全站熱搜

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