Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Errors
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 27-Dec-12 16:42pm
jack_th1.3K
Comments
_Amy at 28-Dec-12 0:02am
   
Is it deployed in IIS?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check this article containing information about this error and solution as well.
Web-Application-Error-Handling-in-ASPNET[^]
 
Got reference from here.[^]
  Permalink  
Comments
jack_th at 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 at 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
-->




Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Comments
jack_th at 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 at 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
-->




Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The problem was fixed now. The actual problem and solution is on this Post[^]
 
Thank you for all attention to this post.
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 395
1 Prakriti Goyal 259
2 Yogesh Kumar Tyagi 224
3 Sergey Alexandrovich Kryukov 167
4 CPallini 160
0 OriginalGriff 6,652
1 Sergey Alexandrovich Kryukov 5,449
2 Maciej Los 3,474
3 Peter Leow 3,303
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100