473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

.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 1927
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*******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.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.hu> wrote in message
news:%2****************@TK2MSFTNGP11.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.hu> wrote in message
news:#L**************@TK2MSFTNGP11.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
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...
1
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...
3
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...
6
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...
3
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...
3
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...
2
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...
2
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
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...
24
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.