Click here to Skip to main content
15,563,332 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an asp.net website install as virtual directory in IIS on Windows server 2003 service pack 2. But, I often found that the website is not working and it occur an error like 'mycustompage.htm?aspxerrorpath=/...aspx ' on address bar and show error on file web.config or sometime on file golbal.asax. After I edit the file web.config or global.asax , it become working again. I noticed if just have many user come to visit this website, it will go bad again.
Any body has experience like this please share to me will be thankful.
Posted
Comments
_Amy 28-Dec-12 0:02am    
Is it deployed in IIS?

Check this article containing information about this error and solution as well.
Web-Application-Error-Handling-in-ASPNET[^]

Got reference from here.[^]
 
Share this answer
 
Comments
jack_th 2-Jan-13 21:54pm    
Thank you, this article is useful. Now, I have added "Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs)Handles MyBase.Error " with the code "server.clearerror()" inside to my global.asax and waiting for any error. If there are no error occur within 3 days, I think this solution is great.
jack_th 6-Jan-13 22:26pm    
Dear Vani Kulkarni,
I am just telling you back that the problem is not fixed. It seems no way to fix that. But I will give you more detail that I am using ms access to be my database and this is my global.asax

<%@ Application Language="VB" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script runat="server">

Dim connString As String = System.Configuration.ConfigurationManager.ConnectionStrings("botConnectionString").ConnectionString.ToString
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

Dim cn As OleDbConnection = New OleDbConnection(connString)
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
cn.Open()
cmd = New OleDbCommand("select amount from tb_visitor", cn)
dr = cmd.ExecuteReader
If dr.Read Then
Application("AllHitedUsers") = dr("amount")
'maxamount = dr("amount")
Else
Application("AllHitedUsers") = 0
End If
cn.Close()
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub

Sub Session_OnStart(ByVal Sender As Object, ByVal E As EventArgs)
'Session.Timeout = 10
Session("Start") = Now
Application.Lock()
Application("ActiveUsers") = CInt(Application("ActiveUsers")) + 1

Dim cn As OleDbConnection = New OleDbConnection(connString)
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
cn.Open()
cmd = New OleDbCommand("select max(amount)as maxamount from tb_visitor", cn)
dr = cmd.ExecuteReader
If dr.Read Then
'Application("AllHitedUsers") = dr("maxamount")
Application("AllHitedUsers") = dr("maxamount")
Else
'Application("AllHitedUsers") = 0
End If
cmd = New OleDbCommand("update tb_visitor set amount=" & Application("AllHitedUsers") + 1 & " where id=1", cn)
cmd.ExecuteNonQuery()
'Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
'dataAdapter.UpdateCommand = dbCommand
'
'Dim dataSet As System.Data.DataSet = New System.Data.DataSet
'dataAdapter.Fill(dataSet)
cn.Close()

End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.

Application.Lock()
Application("ActiveUsers") = CInt(Application("ActiveUsers")) - 1
Application.UnLock()

End Sub
Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs)Handles MyBase.Error
Server.ClearError()

End Sub
</script>

and this is my web.config

<script>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configsections>
<sectiongroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectiongroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
This shows that you've used custom error in your website. As I think this issue is caused due to the web application. You deployed an application on IIS but you are trying to access it as web site.

To get rid of this error follow the steps:

1. Go to IIS Manager
2. Right click on your website and click on "Convert to Applicaiton".

Now start browsing the website.
Check for the application pool if any other error is there.

Hope it helps.
--Amit
 
Share this answer
 
Comments
jack_th 2-Jan-13 22:01pm    
Thank you for the suggestion. My website was created as an application but I will re-check other environments for making sure, if the problem still appear I may need your more suggestions.
jack_th 6-Jan-13 22:32pm    
Dear _Amy,
I am just telling you back that the problem is not fixed. It seems no way to fix that. But I will give you more detail that I am using ms access to be my database and this is my global.asax

<%@ Application Language="VB" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script runat="server">

Dim connString As String = System.Configuration.ConfigurationManager.ConnectionStrings("botConnectionString").ConnectionString.ToString
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

Dim cn As OleDbConnection = New OleDbConnection(connString)
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
cn.Open()
cmd = New OleDbCommand("select amount from tb_visitor", cn)
dr = cmd.ExecuteReader
If dr.Read Then
Application("AllHitedUsers") = dr("amount")
'maxamount = dr("amount")
Else
Application("AllHitedUsers") = 0
End If
cn.Close()
End Sub

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub

Sub Session_OnStart(ByVal Sender As Object, ByVal E As EventArgs)
'Session.Timeout = 10
Session("Start") = Now
Application.Lock()
Application("ActiveUsers") = CInt(Application("ActiveUsers")) + 1

Dim cn As OleDbConnection = New OleDbConnection(connString)
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
cn.Open()
cmd = New OleDbCommand("select max(amount)as maxamount from tb_visitor", cn)
dr = cmd.ExecuteReader
If dr.Read Then
'Application("AllHitedUsers") = dr("maxamount")
Application("AllHitedUsers") = dr("maxamount")
Else
'Application("AllHitedUsers") = 0
End If
cmd = New OleDbCommand("update tb_visitor set amount=" & Application("AllHitedUsers") + 1 & " where id=1", cn)
cmd.ExecuteNonQuery()
'Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
'dataAdapter.UpdateCommand = dbCommand
'
'Dim dataSet As System.Data.DataSet = New System.Data.DataSet
'dataAdapter.Fill(dataSet)
cn.Close()

End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.

Application.Lock()
Application("ActiveUsers") = CInt(Application("ActiveUsers")) - 1
Application.UnLock()

End Sub
Private Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs)Handles MyBase.Error
Server.ClearError()

End Sub
</script>

and this is my web.config

<script>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configsections>
<sectiongroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectiongroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<se>
The problem was fixed now. The actual problem and solution is on this Post[^]

Thank you for all attention to this post.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900