473,473 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Precompiling ASPX/ASCX for discovering compile-time errors...

Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david
Nov 18 '05 #1
7 4476
I am not sure I understand you. Even precompile will not catch typos in the
controls when you are talking about the UI of the page (ie, the tags in the
ASPX). Not having full intellisense is certainly one of the issues; which I
believe can be conquered, if it is worth the time.

There are other options, however.

1. Create a server control instead, which allows you to use the property
sheet
2. Add reference in your code behind to the control. Then, you can
programatically set the property using Intellisense

You can use a product like NAnt (Source Forge open source project), but
precompile will still not catch tag typos.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Holger (David) Wagner" <da***@purple-sunshine.de> wrote in message
news:cf**********@svr7.m-online.net...
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david

Nov 18 '05 #2
Start putting all your server side code in a codebehind file. That way you
compile that code and see errors right away. And if you're using vs.net for
development, you also get the benefits of intellisense, etc.

"Holger (David) Wagner" <da***@purple-sunshine.de> wrote in message
news:cf**********@svr7.m-online.net...
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david

Nov 18 '05 #3
It's a bit strange, but typo errors in property name must be shown when you
"Build" your project.("Build" -> "Build solution") You can even press "F5"
to run you project for checking runtime error...

"Holger (David) Wagner" <da***@purple-sunshine.de> ???
news:cf**********@svr7.m-online.net ???...
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david

Nov 18 '05 #4
Marina wrote:
Start putting all your server side code in a codebehind file. That way you
compile that code and see errors right away. And if you're using vs.net for
development, you also get the benefits of intellisense, etc.


One option, of course, would be using labels etc. and setting their
values from the code behind file. This is how I did it when I started
with ASPX, but this turned out to be rather cumbersome when not using
the designer (which I don't use because it keeps on destroying my HTML
code, hope whidbey will solve this)...

With labels, databinding would also work - but this is also totally not
"compile-safe" (typo in the databinding expression, and your gone...)
What I'm doing right now is using properties in the code-behind file,
which I use in the ascx/aspx-controls. This looks something like this:

<TABLE border="0" cellspacing="0" cellpadding="4">
<TR>
<TD><%= Name %> someText <%= SomeCountX %></TD>
</TR>
</TABLE>

This is much more readable than putting labels in there for Name and
AuditoriumCount, and using labels doesn't even get me any further
concerning the "compile-time security": when I change the IDs of the
labels in the ascx/aspx-file, they may not be automatically be changed
in the codebehind file which will get me NullReferenceExceptions at
runtime (I don't use the designer at all anymore, as it always destroys
my HTML-code).

However, this blows up my codebehind file significantly, and still when
there's a typo in the ascx/aspx-file, I get something like this:

===== START included error message ====

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'SomeCountX' does not exist in
the class or namespace 'ASP.DetailsPage_ascx'

Source Error:
Line 11: <TABLE border="0" cellspacing="0" cellpadding="4">
Line 12: <TR>
Line 13: <TD><%= Name %> someText <%= SomeCountX %></TD>
Line 14: </TR>
Line 15: </TABLE>
Source File: http://localhost/UI/PageContents/DetailsPage.ascx Line: 13

===== END included error message ====

So, this does help me a little bit (misspelling a property is not such a
simple mistake), but blows up my codebehind files significantly. E.g.
when I use a typed dataset (with a couple of columns), I have to repeat
each property of the dataset in my codebehind file - it would be much
more elegant putting this directly into the page (e.g.
dsMyDataSet.MY_TYPED_COLUMN) than having a lot of getters for this, like

public string MyTypedColumnValue {
get { return dsMyDataSet.MY_TYPED_COLUMN; }
}

kind regards,
david
Nov 18 '05 #5
Cowboy (Gregory A. Beamer) [MVP] wrote:
I am not sure I understand you. Even precompile will not catch typos in the
controls when you are talking about the UI of the page (ie, the tags in the
ASPX). Not having full intellisense is certainly one of the issues; which I
believe can be conquered, if it is worth the time.

There are other options, however.

1. Create a server control instead, which allows you to use the property
sheet
I avoid the designer whenever I can as it destroys the HTML code... at
first, I used the designer all the time, with a lot of WebControls... by
now, I've converted to using <%# ... %> and <%= ... %> whenever I can.

When Whidbey stops messing with the HTML code, I might convert back
again, but right now I have switched the design view off...
2. Add reference in your code behind to the control. Then, you can
programatically set the property using Intellisense

You can use a product like NAnt (Source Forge open source project), but
precompile will still not catch tag typos.


I'm not concerned with tag typos... actually, I think VS.NET issues
warnings when the HTML-code is incorrect. Does NAnt support compiling
aspx-pages? And ascx-controls? That would be just what I need...

kind regards,
david
Nov 18 '05 #6
Lau Lei Cheong wrote:
It's a bit strange, but typo errors in property name must be shown when you
"Build" your project.("Build" -> "Build solution") You can even press "F5"
to run you project for checking runtime error...


Is there a setting for this somewhere? I'm talking about using
properties of the codebehind-class in the ASCX/ASPX-page, which my
VS.NET (2003) never notices...

kind regards,
david
Nov 18 '05 #7
Hi David:

Unfortunately no, not until VS.NET 2005.

--
Scott
http://www.OdeToCode.com

On Tue, 17 Aug 2004 20:24:43 +0200, "Holger (David) Wagner"
<da***@purple-sunshine.de> wrote:
Lau Lei Cheong wrote:
It's a bit strange, but typo errors in property name must be shown when you
"Build" your project.("Build" -> "Build solution") You can even press "F5"
to run you project for checking runtime error...


Is there a setting for this somewhere? I'm talking about using
properties of the codebehind-class in the ASCX/ASPX-page, which my
VS.NET (2003) never notices...

kind regards,
david


Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: dh | last post by:
As a simple example, I can't seem to be able to reference a label called "lblOutput" that exists in my test.aspx page from within a User control, TestControl.ascx. I am stumped. Any help is...
4
by: BH | last post by:
I'm looking at the source code of the ASP.NET forum sample application. It has the "code-behind" classes compiled into a separate DLL, totally separated from the aspx/ascx files. Adding the class...
3
by: | last post by:
Hello All, Would someone be able to tell me whether it is possible to encode an ASPX page or an ASCX user control into a DLL and later have the webapplication get the page out to the requesting...
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
1
by: digitalego | last post by:
Sorry if the title is a little confusing... Here is the problem. I am working with a "default.aspx" page that uses a user control I made: ------------------------------ | default.aspx ...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
1
by: Benny Dein | last post by:
Hi I've used the aspnet_compiler.exe and got a folder with a compiled version of my web page. I uploaded the contents of the folder which was default.aspx, precompileapp.config, web.config and...
5
by: Fernando Chilvarguer | last post by:
I'm sure this has come up before but I could not find any post on it. How can I read a variable or property that has been set on a ASPX page from inside a ASCX control. ASPX code: public...
3
by: archsg | last post by:
Hello, I have an ASP.Net 1.1 application that I need to move to a production server on a customer's network. I do not want the customer to have access to any code. It looks like VS2003 does...
2
by: Max2006 | last post by:
Hi, Is there any way to break a web application into separated web projects, so we can re-use pages\? I am trying to put aspx pages and/or ascx pages in separated web projects,
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.