I'm trying to make a hit counter. I have it working but when I add it to my website, I get a web config. error...
<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Dim nCount As Int32 = 0
nCount = GetCounterValue()
lblHitCount.Text = nCount.ToString()
End If
End Sub
Private Function GetCounterValue() As Int32
Dim ctrFile As StreamReader
Dim ctrFileW As FileStream
Dim sw As StreamWriter
Dim strPath As String = Server.MapPath("indexcount.txt")
Dim strCounterContents As String
Dim nCounter As Int32
If (File.Exists(strPath)) Then
ctrFile = File.OpenText(strPath)
strCounterContents = ctrFile.ReadLine().ToString()
ctrFile.Close()
nCounter = Convert.ToInt32(strCounterContents)
Else
nCounter = 0
End If
nCounter += 1
ctrFileW = New FileStream(strPath, FileMode.OpenOrCreate, FileAccess.Write)
sw = New StreamWriter(ctrFileW)
sw.WriteLine(Convert.ToString(nCounter))
sw.Close()
ctrFileW.Close()
Return nCounter
End Function
</script>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<style type="text/css">
.style2 {
color: #000066;
}
.style3 {
text-decoration: underline;
}
.style5 {
color: #000066;
font-weight: bold;
}
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
<span class="style5"><strong>Welcome to Beebe Automotive Service!</strong></span>
</h2>
<p>
<span class="style2"><span class="style3">Location:</span> One mile North of Rock Falls
on Highway 85</span>
</p>
<p>
<marquee class="style2"">We Are <span class="style3">Now Accepting Appointments</span>!!!</marquee>
</p>
<p class="style2">
<span class="style3">Call:</span> (715)672-3261
</p>
<p>
<span class="style2">Or <span class="style3">Contact:</span>
<a href="mailto:customerservices@beebeauto.com" style="color: #3333FF">customerservices@beebeauto.com</a></span>
</p>
<p class="style2">
Like us on Facebook:
<a href="https://www.facebook.com/beebeauto"
style="color: #3333FF">Beebe Automotive Service
</a>
</p>
<p class="style2">
Thank you for visiting. You are visitor number:
</p>
<p class="style2">
<asp:label ID="lblHitCount" runat="server" Height="38px" Width="200px"
Font-Bold="True" Font-Size="X-Large" ForeColor="#000066">
</asp:label>
</p>
</asp:Content>
I get this error:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>