Jump to content
  • Advertisement
Sign in to follow this  
_Madman_

[web] Functions in Global.asax

This topic is 4275 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem that I can't solve for quite a while now. I need a page that uses XslCompiledTransform and has quite enormous hit count. In order to avoid recompiling of the xsl, I would like to keep the XslCompiledTransform in global.asax and reference it from the codebehind of the page I'm using. The code I wrote seems to work just fine in debug/non-published configurations, but throws null reference exception when published.
<%@ Application Language="VB" %>

<object id="transformer" runat="server" scope="application" class="System.Xml.Xsl.XslCompiledTransform" />

<script runat="server">
    
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
        'System.Diagnostics.Debugger.Break()
        Try
            transformer.Load(Server.MapPath("ssheet.xsl"), System.Xml.Xsl.XsltSettings.TrustedXslt, Nothing)
            System.Diagnostics.Debugger.Break()
            System.Threading.Thread.Sleep(1000)
        Catch ex As Exception
            System.Diagnostics.Debugger.Break()
            System.Threading.Thread.Sleep(1000)
        End Try
        System.Diagnostics.Debugger.Break()
        System.Threading.Thread.Sleep(1000)
        Application("transformer") = transformer
    End Sub


and I'm accessing the transformer like this
Dim transformer As Xsl.XslCompiledTransform = Application("transformer")


EDIT: When I managed to break into debugger, I couldn't see the troubling code because of 'the code is optimized'

Share this post


Link to post
Share on other sites
Advertisement
I finally found the solution here: http://www.eps-publications.com/articleprint.aspx?quickid=0403021&page=2&printmode=true

It turns out MS has (I'd qualify it as a bug) mistake in their deployment module. Global.asax is not precompiled in same dll's that regular pages are and it has to be deployed along with the other files. MS tool doesn't do that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!