global.aspx Application_error does not fire on anything other than

Discussion in 'ASP .Net' started by jvcoach23, Jan 14, 2008.

  1. jvcoach23

    jvcoach23 Guest

    I've got a global.aspx file that works in my dev environment (vs 2005).
    When i publish the site to a windows 2000 sp4 box running IIS, the global
    does not seem to fire. Since it's a test server, i've tried granting the
    user that IIS is using with all kinds of rights, that didn't work.... so is
    there some setting i'm missing somewhere.

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
    Dim olog As New dempsey.TextFile
    With olog
    .FileName = "500Errors.txt"

    ..SaveText("-------------------------------------------------------------")
    Dim err As Exception = Server.GetLastError()

    .SaveText(Err.ToString)
    .SaveText(err.StackTrace)
    End With

    Response.Redirect("~/500Error.htm")
    end sub

    and an bit from the web.config file
    <compilation debug="false" strict="false" explicit="true">

    hope someone can help out...
    just to be more complete.. in the appliction_error, i'm also writing some
    info out to a sql database... again.. that works running things out of visual
    studio.. but not when the code is published..

    thanks
    shannon
    jvcoach23, Jan 14, 2008
    #1
    1. Advertising

  2. try using

    Server.GetLastError().GetBaseException()

    That's where all the information is.
    Then call Server.ClearError()
    before you redirect.

    Are you getting an exeption when the call to the Database is made? It's
    another possibility that could be blowing everything up on you.

    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    MetaFinder: http://www.blogmetafinder.com


    "jvcoach23" wrote:

    > I've got a global.aspx file that works in my dev environment (vs 2005).
    > When i publish the site to a windows 2000 sp4 box running IIS, the global
    > does not seem to fire. Since it's a test server, i've tried granting the
    > user that IIS is using with all kinds of rights, that didn't work.... so is
    > there some setting i'm missing somewhere.
    >
    > Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    > ' Code that runs when an unhandled error occurs
    > Dim olog As New dempsey.TextFile
    > With olog
    > .FileName = "500Errors.txt"
    >
    > .SaveText("-------------------------------------------------------------")
    > Dim err As Exception = Server.GetLastError()
    >
    > .SaveText(Err.ToString)
    > .SaveText(err.StackTrace)
    > End With
    >
    > Response.Redirect("~/500Error.htm")
    > end sub
    >
    > and an bit from the web.config file
    > <compilation debug="false" strict="false" explicit="true">
    >
    > hope someone can help out...
    > just to be more complete.. in the appliction_error, i'm also writing some
    > info out to a sql database... again.. that works running things out of visual
    > studio.. but not when the code is published..
    >
    > thanks
    > shannon
    Peter Bromberg [C# MVP], Jan 14, 2008
    #2
    1. Advertising

  3. jvcoach23

    jvcoach23 Guest

    RE: global.aspx Application_error does not fire on anything other

    I'll try that..

    I don't think the sql logging is causing any problems. I'm using a class to
    write to the database, this class is using the same connection string that
    all the other database calls are using and i'm able to do inserts for those.
    i've watched in sql profiler and the sql box is not getting hit by the this
    call... so i don't think it's firing... i understand though that if it was
    getting chocked up on this, that it would make the call.. i've also tried
    writing out to a log file, again, that works when running in visual studio,
    but not when it is published.

    "Peter Bromberg [C# MVP]" wrote:

    > try using
    >
    > Server.GetLastError().GetBaseException()
    >
    > That's where all the information is.
    > Then call Server.ClearError()
    > before you redirect.
    >
    > Are you getting an exeption when the call to the Database is made? It's
    > another possibility that could be blowing everything up on you.
    >
    > -- Peter
    > Site: http://www.eggheadcafe.com
    > UnBlog: http://petesbloggerama.blogspot.com
    > MetaFinder: http://www.blogmetafinder.com
    >
    >
    > "jvcoach23" wrote:
    >
    > > I've got a global.aspx file that works in my dev environment (vs 2005).
    > > When i publish the site to a windows 2000 sp4 box running IIS, the global
    > > does not seem to fire. Since it's a test server, i've tried granting the
    > > user that IIS is using with all kinds of rights, that didn't work.... so is
    > > there some setting i'm missing somewhere.
    > >
    > > Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    > > ' Code that runs when an unhandled error occurs
    > > Dim olog As New dempsey.TextFile
    > > With olog
    > > .FileName = "500Errors.txt"
    > >
    > > .SaveText("-------------------------------------------------------------")
    > > Dim err As Exception = Server.GetLastError()
    > >
    > > .SaveText(Err.ToString)
    > > .SaveText(err.StackTrace)
    > > End With
    > >
    > > Response.Redirect("~/500Error.htm")
    > > end sub
    > >
    > > and an bit from the web.config file
    > > <compilation debug="false" strict="false" explicit="true">
    > >
    > > hope someone can help out...
    > > just to be more complete.. in the appliction_error, i'm also writing some
    > > info out to a sql database... again.. that works running things out of visual
    > > studio.. but not when the code is published..
    > >
    > > thanks
    > > shannon
    jvcoach23, Jan 14, 2008
    #3
  4. jvcoach23

    Shannon Guest

    Hi Peter.. another question

    what is a way that i can test.. or trap if there is something causing the
    application_error to bomb.. i mean.. if i have something wrong with my code
    or something else is going wrong, what is the best way to figure that out...

    if the application_error is running, but i'm bombing out on some of my
    code.. what is somethign that i can put in there to test to see if it's
    running. i'll commit out all my code

    hopefully that way i can give you better info so you can set me straight..

    thanks
    shannon

    "Peter Bromberg [C# MVP]" <> wrote in message
    news:...
    > try using
    >
    > Server.GetLastError().GetBaseException()
    >
    > That's where all the information is.
    > Then call Server.ClearError()
    > before you redirect.
    >
    > Are you getting an exeption when the call to the Database is made? It's
    > another possibility that could be blowing everything up on you.
    >
    > -- Peter
    > Site: http://www.eggheadcafe.com
    > UnBlog: http://petesbloggerama.blogspot.com
    > MetaFinder: http://www.blogmetafinder.com
    >
    >
    > "jvcoach23" wrote:
    >
    >> I've got a global.aspx file that works in my dev environment (vs 2005).
    >> When i publish the site to a windows 2000 sp4 box running IIS, the global
    >> does not seem to fire. Since it's a test server, i've tried granting the
    >> user that IIS is using with all kinds of rights, that didn't work.... so
    >> is
    >> there some setting i'm missing somewhere.
    >>
    >> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    >> ' Code that runs when an unhandled error occurs
    >> Dim olog As New dempsey.TextFile
    >> With olog
    >> .FileName = "500Errors.txt"
    >>
    >> .SaveText("-------------------------------------------------------------")
    >> Dim err As Exception = Server.GetLastError()
    >>
    >> .SaveText(Err.ToString)
    >> .SaveText(err.StackTrace)
    >> End With
    >>
    >> Response.Redirect("~/500Error.htm")
    >> end sub
    >>
    >> and an bit from the web.config file
    >> <compilation debug="false" strict="false" explicit="true">
    >>
    >> hope someone can help out...
    >> just to be more complete.. in the appliction_error, i'm also writing some
    >> info out to a sql database... again.. that works running things out of
    >> visual
    >> studio.. but not when the code is published..
    >>
    >> thanks
    >> shannon
    Shannon, Jan 14, 2008
    #4
  5. jvcoach23

    Jeff Dillon Guest

    Make sure the directory is marked at an IIS Application/virtual directory

    Jeff
    "jvcoach23" <> wrote in message
    news:...
    > I've got a global.aspx file that works in my dev environment (vs 2005).
    > When i publish the site to a windows 2000 sp4 box running IIS, the global
    > does not seem to fire. Since it's a test server, i've tried granting the
    > user that IIS is using with all kinds of rights, that didn't work.... so
    > is
    > there some setting i'm missing somewhere.
    >
    > Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    > ' Code that runs when an unhandled error occurs
    > Dim olog As New dempsey.TextFile
    > With olog
    > .FileName = "500Errors.txt"
    >
    > .SaveText("-------------------------------------------------------------")
    > Dim err As Exception = Server.GetLastError()
    >
    > .SaveText(Err.ToString)
    > .SaveText(err.StackTrace)
    > End With
    >
    > Response.Redirect("~/500Error.htm")
    > end sub
    >
    > and an bit from the web.config file
    > <compilation debug="false" strict="false" explicit="true">
    >
    > hope someone can help out...
    > just to be more complete.. in the appliction_error, i'm also writing some
    > info out to a sql database... again.. that works running things out of
    > visual
    > studio.. but not when the code is published..
    >
    > thanks
    > shannon
    Jeff Dillon, Jan 14, 2008
    #5
  6. jvcoach23

    Shannon Guest

    thanks for the comment.. it is..any other suggestions

    "Jeff Dillon" <> wrote in message
    news:e5$...
    > Make sure the directory is marked at an IIS Application/virtual directory
    >
    > Jeff
    > "jvcoach23" <> wrote in message
    > news:...
    >> I've got a global.aspx file that works in my dev environment (vs 2005).
    >> When i publish the site to a windows 2000 sp4 box running IIS, the global
    >> does not seem to fire. Since it's a test server, i've tried granting the
    >> user that IIS is using with all kinds of rights, that didn't work.... so
    >> is
    >> there some setting i'm missing somewhere.
    >>
    >> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    >> ' Code that runs when an unhandled error occurs
    >> Dim olog As New dempsey.TextFile
    >> With olog
    >> .FileName = "500Errors.txt"
    >>
    >> .SaveText("-------------------------------------------------------------")
    >> Dim err As Exception = Server.GetLastError()
    >>
    >> .SaveText(Err.ToString)
    >> .SaveText(err.StackTrace)
    >> End With
    >>
    >> Response.Redirect("~/500Error.htm")
    >> end sub
    >>
    >> and an bit from the web.config file
    >> <compilation debug="false" strict="false" explicit="true">
    >>
    >> hope someone can help out...
    >> just to be more complete.. in the appliction_error, i'm also writing some
    >> info out to a sql database... again.. that works running things out of
    >> visual
    >> studio.. but not when the code is published..
    >>
    >> thanks
    >> shannon

    >
    >
    Shannon, Jan 15, 2008
    #6
  7. re:
    !> any other suggestions

    1. Make sure the ASPNET account in the W2K server
    ( if you're not impersonating ASP.NET's account ),
    which is the default account ASP.NET runs as under W2K,
    has write permissions to the directory where 500Errors.txt is being written to.

    If you don't know which account ASP.NET runs as in the W2K server,
    save this code as "identity.aspx" and run it on the W2K server.

    identity.aspx:
    -------------------
    <%@ Page Language="VB" %>
    <%@ Import NameSpace = System.Security.Principal %>
    <script runat="server">
    Sub Page_Load()
    Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    Label1.Text = "ASP.NET is running as the account : " & tmp
    End Sub
    </script>
    <html>
    <head>
    <title>What account is ASP.NET running as ?</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    </div>
    </form>
    </body>
    </html>
    ------------

    Whichever account that code returns is the account which needs permissions.

    2. Make sure the account returned by identity.aspx has the
    specific access permissions for the directories listed in this article:

    ASP.NET Required Access Control Lists (ACLs)
    http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

    3. Register-unregister ASP.NET in IIS, by running aspnet_regiis
    from a command window in the .Net Framework's 2.0 directory :

    First unregister :

    aspnet_regiis -u

    Then, re-register :

    aspnet_regiis -i

    That will first delete and then recreate the ASP.NET account,
    assigning the necessary permissions to that account.

    I'd find it very strange if global.asax wouldn't fire,
    if you have a healthy .Net Framework installation.

    If none of these suggestions work, I'd uninstall the .Net Framework 2.0,
    using the Add/Remove Programs applet in Control Panel...and reinstall it fully.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Shannon" <> wrote in message news:e%...
    > thanks for the comment.. it is..any other suggestions
    >
    > "Jeff Dillon" <> wrote in message news:e5$...
    >> Make sure the directory is marked at an IIS Application/virtual directory
    >>
    >> Jeff
    >> "jvcoach23" <> wrote in message
    >> news:...
    >>> I've got a global.aspx file that works in my dev environment (vs 2005).
    >>> When i publish the site to a windows 2000 sp4 box running IIS, the global
    >>> does not seem to fire. Since it's a test server, i've tried granting the
    >>> user that IIS is using with all kinds of rights, that didn't work.... so is
    >>> there some setting i'm missing somewhere.
    >>>
    >>> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    >>> ' Code that runs when an unhandled error occurs
    >>> Dim olog As New dempsey.TextFile
    >>> With olog
    >>> .FileName = "500Errors.txt"
    >>>
    >>> .SaveText("-------------------------------------------------------------")
    >>> Dim err As Exception = Server.GetLastError()
    >>>
    >>> .SaveText(Err.ToString)
    >>> .SaveText(err.StackTrace)
    >>> End With
    >>>
    >>> Response.Redirect("~/500Error.htm")
    >>> end sub
    >>>
    >>> and an bit from the web.config file
    >>> <compilation debug="false" strict="false" explicit="true">
    >>>
    >>> hope someone can help out...
    >>> just to be more complete.. in the appliction_error, i'm also writing some
    >>> info out to a sql database... again.. that works running things out of visual
    >>> studio.. but not when the code is published..
    >>>
    >>> thanks
    >>> shannon

    >>
    >>

    >
    >
    Juan T. Llibre, Jan 15, 2008
    #7
  8. jvcoach23

    Shannon Guest

    thanks...
    i had seen that identity page tip somewhere else.. the account that the test
    box is using is ASPNET and i added that user to the administrator group.. i
    understand that i won't want to do that in production, but in an effort to
    try to figure out what i'm doing wrong so that the global is not working, i
    thought that should open the door pretty wide..

    do you have any other suggestions
    thanks
    shannon
    "Juan T. Llibre" <> wrote in message
    news:...
    > re:
    > !> any other suggestions
    >
    > 1. Make sure the ASPNET account in the W2K server
    > ( if you're not impersonating ASP.NET's account ),
    > which is the default account ASP.NET runs as under W2K,
    > has write permissions to the directory where 500Errors.txt is being
    > written to.
    >
    > If you don't know which account ASP.NET runs as in the W2K server,
    > save this code as "identity.aspx" and run it on the W2K server.
    >
    > identity.aspx:
    > -------------------
    > <%@ Page Language="VB" %>
    > <%@ Import NameSpace = System.Security.Principal %>
    > <script runat="server">
    > Sub Page_Load()
    > Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    > Label1.Text = "ASP.NET is running as the account : " & tmp
    > End Sub
    > </script>
    > <html>
    > <head>
    > <title>What account is ASP.NET running as ?</title>
    > </head>
    > <body>
    > <form id="form1" runat="server">
    > <div>
    > <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    > </div>
    > </form>
    > </body>
    > </html>
    > ------------
    >
    > Whichever account that code returns is the account which needs
    > permissions.
    >
    > 2. Make sure the account returned by identity.aspx has the
    > specific access permissions for the directories listed in this article:
    >
    > ASP.NET Required Access Control Lists (ACLs)
    > http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
    >
    > 3. Register-unregister ASP.NET in IIS, by running aspnet_regiis
    > from a command window in the .Net Framework's 2.0 directory :
    >
    > First unregister :
    >
    > aspnet_regiis -u
    >
    > Then, re-register :
    >
    > aspnet_regiis -i
    >
    > That will first delete and then recreate the ASP.NET account,
    > assigning the necessary permissions to that account.
    >
    > I'd find it very strange if global.asax wouldn't fire,
    > if you have a healthy .Net Framework installation.
    >
    > If none of these suggestions work, I'd uninstall the .Net Framework 2.0,
    > using the Add/Remove Programs applet in Control Panel...and reinstall it
    > fully.
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Shannon" <> wrote in message
    > news:e%...
    >> thanks for the comment.. it is..any other suggestions
    >>
    >> "Jeff Dillon" <> wrote in message
    >> news:e5$...
    >>> Make sure the directory is marked at an IIS Application/virtual
    >>> directory
    >>>
    >>> Jeff
    >>> "jvcoach23" <> wrote in message
    >>> news:...
    >>>> I've got a global.aspx file that works in my dev environment (vs 2005).
    >>>> When i publish the site to a windows 2000 sp4 box running IIS, the
    >>>> global
    >>>> does not seem to fire. Since it's a test server, i've tried granting
    >>>> the
    >>>> user that IIS is using with all kinds of rights, that didn't work....
    >>>> so is
    >>>> there some setting i'm missing somewhere.
    >>>>
    >>>> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    >>>> ' Code that runs when an unhandled error occurs
    >>>> Dim olog As New dempsey.TextFile
    >>>> With olog
    >>>> .FileName = "500Errors.txt"
    >>>>
    >>>> .SaveText("-------------------------------------------------------------")
    >>>> Dim err As Exception = Server.GetLastError()
    >>>>
    >>>> .SaveText(Err.ToString)
    >>>> .SaveText(err.StackTrace)
    >>>> End With
    >>>>
    >>>> Response.Redirect("~/500Error.htm")
    >>>> end sub
    >>>>
    >>>> and an bit from the web.config file
    >>>> <compilation debug="false" strict="false" explicit="true">
    >>>>
    >>>> hope someone can help out...
    >>>> just to be more complete.. in the appliction_error, i'm also writing
    >>>> some
    >>>> info out to a sql database... again.. that works running things out of
    >>>> visual
    >>>> studio.. but not when the code is published..
    >>>>
    >>>> thanks
    >>>> shannon
    >>>
    >>>

    >>
    >>

    >
    >
    Shannon, Jan 15, 2008
    #8
  9. re:
    !> i had seen that identity page tip somewhere else...

    Probably somewhere where I posted...or where someone posted my code without attribution.
    I wrote that ditty. :)

    re:
    !> do you have any other suggestions

    Run through the list of directories in the article link I posted,
    and make sure the ASPNET account has the listed permissions.

    As mentioned earlier, there's no reason for global.asax not to fire,
    and for Application_Error not to fire, too, if you have a healthy install
    of the .Net Framework and the .Net Framework is registered with IIS,
    particularly if, as you say, the same code works in a test environment.

    If none of the suggestions work, and unless the W2K server's admin
    has explicitly forbidden the use of global.asax, uninstalling and reinstalling
    the .Net Framework is the only recourse left.

    Talk to the W2k server's admin...and see what (s)he says.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Shannon" <> wrote in message news:...
    > thanks...
    > i had seen that identity page tip somewhere else.. the account that the test box is using is ASPNET and i added that
    > user to the administrator group.. i understand that i won't want to do that in production, but in an effort to try to
    > figure out what i'm doing wrong so that the global is not working, i thought that should open the door pretty wide..
    >
    > do you have any other suggestions
    > thanks
    > shannon
    > "Juan T. Llibre" <> wrote in message news:...
    >> re:
    >> !> any other suggestions
    >>
    >> 1. Make sure the ASPNET account in the W2K server
    >> ( if you're not impersonating ASP.NET's account ),
    >> which is the default account ASP.NET runs as under W2K,
    >> has write permissions to the directory where 500Errors.txt is being written to.
    >>
    >> If you don't know which account ASP.NET runs as in the W2K server,
    >> save this code as "identity.aspx" and run it on the W2K server.
    >>
    >> identity.aspx:
    >> -------------------
    >> <%@ Page Language="VB" %>
    >> <%@ Import NameSpace = System.Security.Principal %>
    >> <script runat="server">
    >> Sub Page_Load()
    >> Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    >> Label1.Text = "ASP.NET is running as the account : " & tmp
    >> End Sub
    >> </script>
    >> <html>
    >> <head>
    >> <title>What account is ASP.NET running as ?</title>
    >> </head>
    >> <body>
    >> <form id="form1" runat="server">
    >> <div>
    >> <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    >> </div>
    >> </form>
    >> </body>
    >> </html>
    >> ------------
    >>
    >> Whichever account that code returns is the account which needs permissions.
    >>
    >> 2. Make sure the account returned by identity.aspx has the
    >> specific access permissions for the directories listed in this article:
    >>
    >> ASP.NET Required Access Control Lists (ACLs)
    >> http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
    >>
    >> 3. Register-unregister ASP.NET in IIS, by running aspnet_regiis
    >> from a command window in the .Net Framework's 2.0 directory :
    >>
    >> First unregister :
    >>
    >> aspnet_regiis -u
    >>
    >> Then, re-register :
    >>
    >> aspnet_regiis -i
    >>
    >> That will first delete and then recreate the ASP.NET account,
    >> assigning the necessary permissions to that account.
    >>
    >> I'd find it very strange if global.asax wouldn't fire,
    >> if you have a healthy .Net Framework installation.
    >>
    >> If none of these suggestions work, I'd uninstall the .Net Framework 2.0,
    >> using the Add/Remove Programs applet in Control Panel...and reinstall it fully.
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "Shannon" <> wrote in message news:e%...
    >>> thanks for the comment.. it is..any other suggestions
    >>>
    >>> "Jeff Dillon" <> wrote in message news:e5$...
    >>>> Make sure the directory is marked at an IIS Application/virtual directory
    >>>>
    >>>> Jeff
    >>>> "jvcoach23" <> wrote in message
    >>>> news:...
    >>>>> I've got a global.aspx file that works in my dev environment (vs 2005).
    >>>>> When i publish the site to a windows 2000 sp4 box running IIS, the global
    >>>>> does not seem to fire. Since it's a test server, i've tried granting the
    >>>>> user that IIS is using with all kinds of rights, that didn't work.... so is
    >>>>> there some setting i'm missing somewhere.
    >>>>>
    >>>>> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    >>>>> ' Code that runs when an unhandled error occurs
    >>>>> Dim olog As New dempsey.TextFile
    >>>>> With olog
    >>>>> .FileName = "500Errors.txt"
    >>>>>
    >>>>> .SaveText("-------------------------------------------------------------")
    >>>>> Dim err As Exception = Server.GetLastError()
    >>>>>
    >>>>> .SaveText(Err.ToString)
    >>>>> .SaveText(err.StackTrace)
    >>>>> End With
    >>>>>
    >>>>> Response.Redirect("~/500Error.htm")
    >>>>> end sub
    >>>>>
    >>>>> and an bit from the web.config file
    >>>>> <compilation debug="false" strict="false" explicit="true">
    >>>>>
    >>>>> hope someone can help out...
    >>>>> just to be more complete.. in the appliction_error, i'm also writing some
    >>>>> info out to a sql database... again.. that works running things out of visual
    >>>>> studio.. but not when the code is published..
    >>>>>
    >>>>> thanks
    >>>>> shannon
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Juan T. Llibre, Jan 15, 2008
    #9
  10. jvcoach23

    Shannon Guest

    ok.. i'll get to work on that.. i'm the admin of the IIS box.. it's just a
    test box that is running on it's own workgroup... I've got the 1.1 and 2.0
    framework installed on the box...

    I'll go through that link.. and post what happens...

    thanks
    "Juan T. Llibre" <> wrote in message
    news:%23%...
    > re:
    > !> i had seen that identity page tip somewhere else...
    >
    > Probably somewhere where I posted...or where someone posted my code
    > without attribution.
    > I wrote that ditty. :)
    >
    > re:
    > !> do you have any other suggestions
    >
    > Run through the list of directories in the article link I posted,
    > and make sure the ASPNET account has the listed permissions.
    >
    > As mentioned earlier, there's no reason for global.asax not to fire,
    > and for Application_Error not to fire, too, if you have a healthy install
    > of the .Net Framework and the .Net Framework is registered with IIS,
    > particularly if, as you say, the same code works in a test environment.
    >
    > If none of the suggestions work, and unless the W2K server's admin
    > has explicitly forbidden the use of global.asax, uninstalling and
    > reinstalling
    > the .Net Framework is the only recourse left.
    >
    > Talk to the W2k server's admin...and see what (s)he says.
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Shannon" <> wrote in message
    > news:...
    >> thanks...
    >> i had seen that identity page tip somewhere else.. the account that the
    >> test box is using is ASPNET and i added that user to the administrator
    >> group.. i understand that i won't want to do that in production, but in
    >> an effort to try to figure out what i'm doing wrong so that the global is
    >> not working, i thought that should open the door pretty wide..
    >>
    >> do you have any other suggestions
    >> thanks
    >> shannon
    >> "Juan T. Llibre" <> wrote in message
    >> news:...
    >>> re:
    >>> !> any other suggestions
    >>>
    >>> 1. Make sure the ASPNET account in the W2K server
    >>> ( if you're not impersonating ASP.NET's account ),
    >>> which is the default account ASP.NET runs as under W2K,
    >>> has write permissions to the directory where 500Errors.txt is being
    >>> written to.
    >>>
    >>> If you don't know which account ASP.NET runs as in the W2K server,
    >>> save this code as "identity.aspx" and run it on the W2K server.
    >>>
    >>> identity.aspx:
    >>> -------------------
    >>> <%@ Page Language="VB" %>
    >>> <%@ Import NameSpace = System.Security.Principal %>
    >>> <script runat="server">
    >>> Sub Page_Load()
    >>> Dim tmp As String = WindowsIdentity.GetCurrent.Name()
    >>> Label1.Text = "ASP.NET is running as the account : " & tmp
    >>> End Sub
    >>> </script>
    >>> <html>
    >>> <head>
    >>> <title>What account is ASP.NET running as ?</title>
    >>> </head>
    >>> <body>
    >>> <form id="form1" runat="server">
    >>> <div>
    >>> <asp:Label ID="Label1" Runat="server" Text="Label"></asp:Label>
    >>> </div>
    >>> </form>
    >>> </body>
    >>> </html>
    >>> ------------
    >>>
    >>> Whichever account that code returns is the account which needs
    >>> permissions.
    >>>
    >>> 2. Make sure the account returned by identity.aspx has the
    >>> specific access permissions for the directories listed in this article:
    >>>
    >>> ASP.NET Required Access Control Lists (ACLs)
    >>> http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx
    >>>
    >>> 3. Register-unregister ASP.NET in IIS, by running aspnet_regiis
    >>> from a command window in the .Net Framework's 2.0 directory :
    >>>
    >>> First unregister :
    >>>
    >>> aspnet_regiis -u
    >>>
    >>> Then, re-register :
    >>>
    >>> aspnet_regiis -i
    >>>
    >>> That will first delete and then recreate the ASP.NET account,
    >>> assigning the necessary permissions to that account.
    >>>
    >>> I'd find it very strange if global.asax wouldn't fire,
    >>> if you have a healthy .Net Framework installation.
    >>>
    >>> If none of these suggestions work, I'd uninstall the .Net Framework 2.0,
    >>> using the Add/Remove Programs applet in Control Panel...and reinstall it
    >>> fully.
    >>>
    >>>
    >>>
    >>> Juan T. Llibre, asp.net MVP
    >>> asp.net faq : http://asp.net.do/faq/
    >>> foros de asp.net, en español : http://asp.net.do/foros/
    >>> ======================================
    >>> "Shannon" <> wrote in message
    >>> news:e%...
    >>>> thanks for the comment.. it is..any other suggestions
    >>>>
    >>>> "Jeff Dillon" <> wrote in message
    >>>> news:e5$...
    >>>>> Make sure the directory is marked at an IIS Application/virtual
    >>>>> directory
    >>>>>
    >>>>> Jeff
    >>>>> "jvcoach23" <> wrote in message
    >>>>> news:...
    >>>>>> I've got a global.aspx file that works in my dev environment (vs
    >>>>>> 2005).
    >>>>>> When i publish the site to a windows 2000 sp4 box running IIS, the
    >>>>>> global
    >>>>>> does not seem to fire. Since it's a test server, i've tried granting
    >>>>>> the
    >>>>>> user that IIS is using with all kinds of rights, that didn't work....
    >>>>>> so is
    >>>>>> there some setting i'm missing somewhere.
    >>>>>>
    >>>>>> Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    >>>>>> ' Code that runs when an unhandled error occurs
    >>>>>> Dim olog As New dempsey.TextFile
    >>>>>> With olog
    >>>>>> .FileName = "500Errors.txt"
    >>>>>>
    >>>>>> .SaveText("-------------------------------------------------------------")
    >>>>>> Dim err As Exception = Server.GetLastError()
    >>>>>>
    >>>>>> .SaveText(Err.ToString)
    >>>>>> .SaveText(err.StackTrace)
    >>>>>> End With
    >>>>>>
    >>>>>> Response.Redirect("~/500Error.htm")
    >>>>>> end sub
    >>>>>>
    >>>>>> and an bit from the web.config file
    >>>>>> <compilation debug="false" strict="false" explicit="true">
    >>>>>>
    >>>>>> hope someone can help out...
    >>>>>> just to be more complete.. in the appliction_error, i'm also writing
    >>>>>> some
    >>>>>> info out to a sql database... again.. that works running things out
    >>>>>> of visual
    >>>>>> studio.. but not when the code is published..
    >>>>>>
    >>>>>> thanks
    >>>>>> shannon
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Shannon, Jan 15, 2008
    #10
  11. jvcoach23

    jvcoach23 Guest

    On Tue, 15 Jan 2008 10:11:20 -0600, Shannon wrote:
    Well.. i checked the rights according to the article... the user that the
    website is running under is ASPNET. that user has the rights that the
    article describes... except for this line.. i'm not sure if about it

    User profile directory
    Used by the GAC cache lock files and the security configuration caching
    mechanism of the common language runtime. If the user profile directory for
    the account does not exist, ASP.NET uses the default user profile
    directory.

    i added the user with rigts to the the C:\Documents and Settings\SERVER1
    dir (server1/aspnet is the user that shows up when i run the identity page)

    so then i uninstalled .net 1.1 and 2.0... uninstalled iis.
    reinstalled 1.1 and 2.0. then reinstalled iis

    created the application in iis
    published the website
    had to run aspnet_regiis -i in the 2.0 framework and the website runs, but
    the global still is not "working"

    what kind of troubleshooting steps can i take to see if the global really
    is working but what i'm asking it to do inside the application_error is
    bombing, or if the global itself isn't working.

    any suggestion would be great
    thanks
    shannon
    jvcoach23, Jan 16, 2008
    #11
  12. Here's a simple test...

    Include this in global.asax :

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    Server.Transfer("Errors.aspx")
    End Sub

    Include this in "errors.aspx" :

    errors.aspx:
    -------------------
    <html>
    <script language="VB" runat="server">
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim errMessage As String = ""
    Dim appException As System.Exception = Server.GetLastError()
    If (TypeOf (appException) Is HttpException) Then
    Dim checkException As HttpException = CType(appException, HttpException)
    Select Case checkException.GetHttpCode
    Case 400
    errMessage &= "Bad request. The file size is too large."
    Case 401
    errMessage &= "You are not authorized to view this page."
    Case 403
    errMessage &= "You are not allowed to view that page."
    Case 404
    errMessage &= "The page you have requested can't be found."
    Case 408
    errMessage &= "The request has timed out."
    Case 500
    errMessage &= "The server can't fulfill your request."
    Case Else
    errMessage &= "The server has experienced an error."
    End Select
    Else
    errMessage &= "The following error occurred<BR>" & appException.ToString
    End If
    ErrorMessage.Text = errMessage & "<BR>We're sorry for the inconvenience."
    Server.ClearError()
    End Sub
    </script>
    <body>
    <asp:label id="ErrorMessage" font-size="12" font-bold="true" runat=server/>
    </body>
    </html>
    --------------

    Finally, inside the system.web section of web.config, include this :

    <customErrors mode="On" />

    To test, write any invalid URL in the address bar...and see if you get the custom message.
    That will tell you whether Global.asax, and Application_Error within it, are firing.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "jvcoach23" <> wrote in message news:gj73y512ymbu$...
    > On Tue, 15 Jan 2008 10:11:20 -0600, Shannon wrote:
    > Well.. i checked the rights according to the article... the user that the
    > website is running under is ASPNET. that user has the rights that the
    > article describes... except for this line.. i'm not sure if about it
    >
    > User profile directory
    > Used by the GAC cache lock files and the security configuration caching
    > mechanism of the common language runtime. If the user profile directory for
    > the account does not exist, ASP.NET uses the default user profile
    > directory.
    >
    > i added the user with rigts to the the C:\Documents and Settings\SERVER1
    > dir (server1/aspnet is the user that shows up when i run the identity page)
    >
    > so then i uninstalled .net 1.1 and 2.0... uninstalled iis.
    > reinstalled 1.1 and 2.0. then reinstalled iis
    >
    > created the application in iis
    > published the website
    > had to run aspnet_regiis -i in the 2.0 framework and the website runs, but
    > the global still is not "working"
    >
    > what kind of troubleshooting steps can i take to see if the global really
    > is working but what i'm asking it to do inside the application_error is
    > bombing, or if the global itself isn't working.
    >
    > any suggestion would be great
    > thanks
    > shannon
    Juan T. Llibre, Jan 16, 2008
    #12
  13. jvcoach23

    jvcoach23 Guest

    i did as you suggested... added the code to the application_error and
    commented out all my code that was in that sub

    added the new page

    modified the web.config file

    when i hit the page that does not exists, i get a page "The page cannot be
    found" error. i do not get redirected.

    so after having checked the rights for the user, uninstalling and
    reinstalling .net and IIS, what is the next step in the troubleshooting
    list.

    thanks again for all the pointers and help. Hope you can continue to help
    me through this.

    thanks
    shannon
    jvcoach23, Jan 16, 2008
    #13
  14. Try using the .aspx extension...

    Look at the difference between :

    http://asp.net.do/test/some.html
    and
    http://asp.net.do/test/some.aspx

    If you want non-existent .html pages to be responded to with a custom page,
    add the extension to the files processed by ASP.NET.



    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "jvcoach23" <> wrote in message news:di2vo1o5m12c$...
    >i did as you suggested... added the code to the application_error and
    > commented out all my code that was in that sub
    >
    > added the new page
    >
    > modified the web.config file
    >
    > when i hit the page that does not exists, i get a page "The page cannot be
    > found" error. i do not get redirected.
    >
    > so after having checked the rights for the user, uninstalling and
    > reinstalling .net and IIS, what is the next step in the troubleshooting
    > list.
    >
    > thanks again for all the pointers and help. Hope you can continue to help
    > me through this.
    >
    > thanks
    > shannon
    Juan T. Llibre, Jan 16, 2008
    #14
  15. Another option is to simply set a custom page for 404 errors in IIS.


    "Juan T. Llibre" <> wrote in message
    news:...
    > Try using the .aspx extension...
    >
    > Look at the difference between :
    >
    > http://asp.net.do/test/some.html
    > and
    > http://asp.net.do/test/some.aspx
    >
    > If you want non-existent .html pages to be responded to with a custom
    > page,
    > add the extension to the files processed by ASP.NET.
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "jvcoach23" <> wrote in message
    > news:di2vo1o5m12c$...
    >>i did as you suggested... added the code to the application_error and
    >> commented out all my code that was in that sub
    >>
    >> added the new page
    >>
    >> modified the web.config file
    >>
    >> when i hit the page that does not exists, i get a page "The page cannot
    >> be
    >> found" error. i do not get redirected.
    >>
    >> so after having checked the rights for the user, uninstalling and
    >> reinstalling .net and IIS, what is the next step in the troubleshooting
    >> list.
    >>
    >> thanks again for all the pointers and help. Hope you can continue to
    >> help
    >> me through this.
    >>
    >> thanks
    >> shannon

    >
    >
    Scott Roberts, Jan 16, 2008
    #15
  16. re:
    !> Another option is to simply set a custom page for 404 errors in IIS.

    404s for html, asp, etc. are handled "out of the box" by IIS,
    without the need for a custom page for 404 errors, but .aspx files are not.

    Remember, .aspx files go through the ASP.NET ISAPI application; html, asp, etc. files don't.

    You're right, though, that is an option...for html files, for .asp files and,
    in general, for any file that doesn't go through the ASP.NET ISAPI app.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Scott Roberts" <-webworks-software.com> wrote in message
    news:...
    > Another option is to simply set a custom page for 404 errors in IIS.



    > "Juan T. Llibre" <> wrote in message news:...
    >> Try using the .aspx extension...
    >>
    >> Look at the difference between :
    >>
    >> http://asp.net.do/test/some.html
    >> and
    >> http://asp.net.do/test/some.aspx
    >>
    >> If you want non-existent .html pages to be responded to with a custom page,
    >> add the extension to the files processed by ASP.NET.
    >>
    >>
    >>
    >> Juan T. Llibre, asp.net MVP
    >> asp.net faq : http://asp.net.do/faq/
    >> foros de asp.net, en español : http://asp.net.do/foros/
    >> ======================================
    >> "jvcoach23" <> wrote in message news:di2vo1o5m12c$...
    >>>i did as you suggested... added the code to the application_error and
    >>> commented out all my code that was in that sub
    >>>
    >>> added the new page
    >>>
    >>> modified the web.config file
    >>>
    >>> when i hit the page that does not exists, i get a page "The page cannot be
    >>> found" error. i do not get redirected.
    >>>
    >>> so after having checked the rights for the user, uninstalling and
    >>> reinstalling .net and IIS, what is the next step in the troubleshooting
    >>> list.
    >>>
    >>> thanks again for all the pointers and help. Hope you can continue to help
    >>> me through this.
    >>>
    >>> thanks
    >>> shannon

    >>
    >>

    >
    Juan T. Llibre, Jan 16, 2008
    #16
  17. "Scott Roberts" <-webworks-software.com> wrote in
    message news:...

    > Another option is to simply set a custom page for 404 errors in IIS.


    Not always an option with a public Internet site hosted with a 3rd-party
    ISP...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
    Mark Rae [MVP], Jan 16, 2008
    #17
  18. jvcoach23

    jvcoach23 Guest

    Here is the sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    Server.Transfer("~/Errors.aspx")
    'some commented out code
    End Sub

    and the name of the file it's going to is Errors.aspx.. all the code in the
    files is as you had.

    I've double checked, republished and i'm getting teh page cannot be found
    message.. The redirect never takes place.

    your code does redirect when i run it from vb.

    again.. thanks for the help.. hope your willing to continue
    thanks
    shannon
    jvcoach23, Jan 16, 2008
    #18
  19. jvcoach23

    jvcoach23 Guest

    yep.. i understand what your saying. but in the global.asax file, i have
    some code to gather some info and store it to a database... that's why i am
    trying to go this route..

    thanks for the input though
    shannon

    On Wed, 16 Jan 2008 11:45:56 -0600, Scott Roberts wrote:

    > Another option is to simply set a custom page for 404 errors in IIS.
    >
    >
    > "Juan T. Llibre" <> wrote in message
    > news:...
    jvcoach23, Jan 16, 2008
    #19
  20. jvcoach23

    jvcoach23 Guest

    ok.. the server.transfer seems to be working.. kind of.. need some
    education here.

    I loaded up sysinternals file monitor to see if i could better understand
    if there was an access error. that is where i noticed that i was trying
    to hit a file with an extension of aspx1... i put the 1 in my link to make
    the file so that it was not found.. but after the post talking about the
    html vs the aspx, i changed the dead link to be an aspx extension instead.

    I republished and now i click on the dead link and the address bar shows
    the dead link url, but the message on the screen is

    The page you have requested can't be found.
    We're sorry for the inconvenience.

    from the page that i created per the advice of someone on this thread. so,
    the server.transfer("~/Errors.aspx") verbage is showing up, but the url is
    the dead link... does that sound correct.

    i'm gonna put my code back in and keep on trying things.. just didn't want
    someone running up the wrong tree trying to help guide me.. hoping somone
    can still education me on the server.transfer and addresss line thing
    mentioend above.

    thanks
    shannon
    jvcoach23, Jan 16, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Malter
    Replies:
    3
    Views:
    4,889
    Marshal Antony
    Mar 29, 2004
  2. =?Utf-8?B?UGhpbA==?=

    application_error wont' fire

    =?Utf-8?B?UGhpbA==?=, Jul 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    531
    =?Utf-8?B?UGhpbA==?=
    Jul 19, 2005
  3. Andy G

    Application_Error does not fire

    Andy G, Dec 22, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    3,899
  4. Replies:
    2
    Views:
    527
  5. vikram
    Replies:
    1
    Views:
    852
    Karl Seguin [MVP]
    Oct 4, 2006
Loading...

Share This Page