Compilation debug=false in web.config gives errors in application

Discussion in 'ASP .Net' started by Jonas, Jan 16, 2006.

  1. Jonas

    Jonas Guest

    Hi,

    I've recently found out that I'm supposed to set the debug attribute of the
    compilation element in web.config to false in production environments. But
    when I do so in my ASP.NET application, I get strange errors. Apparently, a
    javascript file that I specify in the vb-code doesn't get called, I and when
    I check the source sent to the browser, I can see that the call to the
    javascript file is changed so that the filename is prefixed by an
    underscore, see first line below. But not all calls are modified, see second
    line below.

    <script language=javascript src="./WebModules/Scripts/_UsrsDetail.js"
    ></script>


    <script language='javascript'
    src='./WebModules/Scripts/cmAddress.js'></script>

    The name of the script file failing is the same as the ascx-file calling it
    (usrsdetail.asxc).

    What happens when I change the debug switch??

    TIA

    Jonas
    Jonas, Jan 16, 2006
    #1
    1. Advertising

  2. Jonas

    Jonas Guest

    I've solved the problem. I use a base class for the ascx control loaded, and
    in the page_load event I retrieved the name of the derived ascx by the
    sender parameter which apparently got prefixed with an underscore when run
    in non-debug mode.

    Private Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    _strUniqueName = sender.ToString.Replace("ASP.", "").Replace("_ascx",
    "").Replace("_aspx", "")

    Now I use this code instead and it works:

    Private Sub Page_Load(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    _strUniqueName = Me.GetType.Name.Replace("_ascx", "")

    /Jonas

    "Jonas" <> wrote in message
    news:...
    > Hi,
    >
    > I've recently found out that I'm supposed to set the debug attribute of

    the
    > compilation element in web.config to false in production environments. But
    > when I do so in my ASP.NET application, I get strange errors. Apparently,

    a
    > javascript file that I specify in the vb-code doesn't get called, I and

    when
    > I check the source sent to the browser, I can see that the call to the
    > javascript file is changed so that the filename is prefixed by an
    > underscore, see first line below. But not all calls are modified, see

    second
    > line below.
    >
    > <script language=javascript src="./WebModules/Scripts/_UsrsDetail.js"
    > ></script>

    >
    > <script language='javascript'
    > src='./WebModules/Scripts/cmAddress.js'></script>
    >
    > The name of the script file failing is the same as the ascx-file calling

    it
    > (usrsdetail.asxc).
    >
    > What happens when I change the debug switch??
    >
    > TIA
    >
    > Jonas
    >
    >
    Jonas, Jan 16, 2006
    #2
    1. Advertising

  3. Jonas

    KevinAndrewLipscomb

    Joined:
    Dec 2, 2010
    Messages:
    1
    Thanks!

    Jonas,

    Thank you for this post! I too was relying on GetType to behave consistently whether debug was true or false in the compilation element in Web.config. I will add that I only saw the problem after moving my app from a pre-IIS7 server to an IIS7 server.

    -- Kevin
    KevinAndrewLipscomb, Dec 2, 2010
    #3
    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. Jeremy S.
    Replies:
    2
    Views:
    6,159
    Jeremy S.
    Jan 19, 2005
  2. RonL
    Replies:
    0
    Views:
    728
  3. André
    Replies:
    3
    Views:
    1,559
  4. Replies:
    10
    Views:
    299
    Thomas 'PointedEars' Lahn
    Feb 16, 2006
  5. Luca Risolia
    Replies:
    1
    Views:
    318
Loading...

Share This Page