473,581 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.ASPX -> .CS generation

Hi!

When I make a request to an ASPX file, it is converted into a C# source file
(given, the language is C#). This source can be seen, if I intentionally put
in something bad between <% ... %>, because it is treated as source code,
and if it is wrong, the C# compiler issues an error, when compiling this
generated .CS file.

I would like to know, what program/utility is used by IIS/ASP.NET to
generate .CS from .ASPX? Theoretically, if I would generate the .CS by hand,
and compile it, it would be possible to create websites that are fully
compiled in a DLL, right? Is there such a utility that permits me to do it?
I found no information, whatsoever, about how this part of ASP.NET works.

Thanks

Lenard
Nov 18 '05 #1
4 1934
Dear Lenard

When you make a request to an ASPX file, it is not converted into C# file.

It performs object initializatio
then it loads the viewstate dat
then it performs the LoadPostData Processes Postback Dat
it then loads the object
then it raises postback change event
it processes client side postback even
then prerendering of objects take plac
viewstate is saved the
then the HTML is rendered

when you request a page, only the HTML is rendered and the scripts are executed only at the server side

there are hell a lot of things that happen when you request an aspx page :) thats why when the page first loads, i
takes sometime, the aspx page is compiled at runtime and hence takes sometime to get loaded the first time

hope it helps

----- Lenard Gunda wrote: ----

Hi

When I make a request to an ASPX file, it is converted into a C# source fil
(given, the language is C#). This source can be seen, if I intentionally pu
in something bad between <% ... %>, because it is treated as source code
and if it is wrong, the C# compiler issues an error, when compiling thi
generated .CS file

I would like to know, what program/utility is used by IIS/ASP.NET t
generate .CS from .ASPX? Theoretically, if I would generate the .CS by hand
and compile it, it would be possible to create websites that are full
compiled in a DLL, right? Is there such a utility that permits me to do it
I found no information, whatsoever, about how this part of ASP.NET works

Thank

Lenar

Nov 18 '05 #2
It does create a C# source file!

I added:

<% if true then .. %>

to the middle of an ASPX file. It reported a CSC compile time error, and I
was able to view the file being compiled, which was auto generated, and was
a C# class derived from my code behind class of the page, that outputted
through HtmlTextWriter the page content, created and initialized the
controls based on specified attributes, and called the controls to render
themselves. It even showed me the command line that was used to compile it.
The command line contained the temporal filesnames as well.

No doubt, it does many things when requesting an ASPX file, but this step is
one of it, and I am wondering if there is a program that can be used (or
command line arguments to something) to generate this .CS file?

-Lenard

"ranganh" <an*******@disc ussions.microso ft.com> wrote in message
news:67******** *************** ***********@mic rosoft.com...
Dear Lenard,

When you make a request to an ASPX file, it is not converted into C# file.

It performs object initialization
then it loads the viewstate data
then it performs the LoadPostData Processes Postback Data
it then loads the objects
then it raises postback change events
it processes client side postback event
then prerendering of objects take place
viewstate is saved then
then the HTML is rendered.

when you request a page, only the HTML is rendered and the scripts are executed only at the server side.
there are hell a lot of things that happen when you request an aspx page :) thats why when the page first loads, it takes sometime, the aspx page is compiled at runtime and hence takes sometime to get loaded the first time.
hope it helps.


----- Lenard Gunda wrote: -----

Hi!

When I make a request to an ASPX file, it is converted into a C# source file (given, the language is C#). This source can be seen, if I intentionally put in something bad between <% ... %>, because it is treated as source code, and if it is wrong, the C# compiler issues an error, when compiling this generated .CS file.

I would like to know, what program/utility is used by IIS/ASP.NET to
generate .CS from .ASPX? Theoretically, if I would generate the .CS by hand, and compile it, it would be possible to create websites that are fully compiled in a DLL, right? Is there such a utility that permits me to do it? I found no information, whatsoever, about how this part of ASP.NET works.
Thanks

Lenard

Nov 18 '05 #3
In .NET 2.0 (Whidbey), the ASPX is compiled in with the C#. In .NET 1.0, the
C# portion is compiled, but the ASPX tags are not.

As far as hiding source, the web server is supposed to accomplish this, at
least from the masses. The more proper methodology, however, is to put your
code into a CodeBehind file. MS mucks this up with .NET 2.0, IMO, by making
code in page a default, but the zero deploy, or everything compiled, solves
the danger of this coding methodology.

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

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Lenard Gunda" <fr****@fbi.h u> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi!

When I make a request to an ASPX file, it is converted into a C# source file (given, the language is C#). This source can be seen, if I intentionally put in something bad between <% ... %>, because it is treated as source code,
and if it is wrong, the C# compiler issues an error, when compiling this
generated .CS file.

I would like to know, what program/utility is used by IIS/ASP.NET to
generate .CS from .ASPX? Theoretically, if I would generate the .CS by hand, and compile it, it would be possible to create websites that are fully
compiled in a DLL, right? Is there such a utility that permits me to do it? I found no information, whatsoever, about how this part of ASP.NET works.

Thanks

Lenard

Nov 18 '05 #4
the parse and compile of an aspx page is done by the asp.net handler code by
building a dll per aspx page. While you could parse and build the dll's in
advance, there is no way to tell asp.net that you did it.

you will have to wait to version 2, where asp.net supports pre-compiling
the web site.
-- bruce (sqlwork.com)

"Lenard Gunda" <fr****@fbi.h u> wrote in message
news:#L******** ******@TK2MSFTN GP11.phx.gbl...
Hi!

When I make a request to an ASPX file, it is converted into a C# source file (given, the language is C#). This source can be seen, if I intentionally put in something bad between <% ... %>, because it is treated as source code,
and if it is wrong, the C# compiler issues an error, when compiling this
generated .CS file.

I would like to know, what program/utility is used by IIS/ASP.NET to
generate .CS from .ASPX? Theoretically, if I would generate the .CS by hand, and compile it, it would be possible to create websites that are fully
compiled in a DLL, right? Is there such a utility that permits me to do it? I found no information, whatsoever, about how this part of ASP.NET works.

Thanks

Lenard

Nov 18 '05 #5

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

Similar topics

3
3959
by: Stevie_mac | last post by:
It might be me but... I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I do geta Page_Load event when an item on the ASPX (inside the iFrame) is clicked but then IsPostBack=False by now!. The ASPX is opened via client side script (into an iFrame) inside a .HTM file (as ASPX postback causes problems in a modal...
1
2802
by: Jerry Tovar | last post by:
I am using .Net 2003 on a XPPro running IIS. I am unable to view any of my ASPX webforms in a browser unless I modify the .ASPX file and replace Codebehind="employee.aspx.cs" with src="employee.aspx.cs". It looks like my bin/employee.dll file is not being used. Instead, my employee.aspx.cs file is being used.
3
9846
by: Tom | last post by:
Hi, I have an index.aspx page which includes top.aspx, left.aspx, main.aspx and bottom.aspx. In the left.aspx, there is a login web control - login.ascx. It keeps session of username and role after successful login and shows welcome user message and his shopping cart link.
6
3557
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html error page. All six steps in the article work just fine. Then at the end of the article, there is a little comment about redirecting errors to an aspx...
3
1838
by: DavidS | last post by:
Have parent.aspx from which I open Driver.aspx form via button on parent.aspx. When I first open the modal dialog, the driver.aspx Page_Load function is called. After I close the dialog, then reopen the form again by clicking the button control from the parent - the Page_Load function is not called. parent.aspx <script block> function...
3
2708
by: Evan | last post by:
I have a web page with 2 frames. The left frame is running menu.aspx and the right frame is running images.aspx. When a selection is made in menu.aspx I call a method in images.aspx and pass a variable. The intention is that images.aspx will take the variable and load images into its frame (the right one) based on the variable passed. What...
2
1997
by: WJ | last post by:
I have three ASPX pages: 1. "WebForm1.aspx" is interactive, responsible for calling a web site (https://www.payMe.com) with $$$. It is working fine. 2. "WebForm2.aspx" is non-interactive, a listener in my site to capture a "STATUS_CD" returned by www.payMe.com. It is working fine. 3. "WebForm3.aspx" is interactive page, responsibe to...
2
2168
by: Janusz Jezowicz | last post by:
Hello! I would like to have one page on the server, which would be a target processing page for a number of other aspx pages. E.g Processing page \portal_page.aspx Target pages
10
2421
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code...
24
2739
by: John Rivers | last post by:
ASPX which means ASPX pages, the code-behind concept, User Controls, Web Controls etc. is very poorly designed and makes it extremely hard to develop professional quality web applications. ASPX is Microsoft's attempt to "dumb down" web application development to help unskilled developers such as web design agencies achieve some results. ...
0
7868
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8149
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5364
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3805
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1403
muto222
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.