By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,414 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jan 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <Jo***@nospam.pl> wrote in message
news:OU**************@TK2MSFTNGP12.phx.gbl...
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

Jan 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.