Page Processing

G

Guest

I have a problem at the moment where an external program writes aspx files
to a server and then allows people to brows to those pages. Each aspx page
is similiar and is written in a single file - the file contains both <%= %>
attributes and <SCRIPT runat=server> code. Each file has a unique name.

After a short time this gets out-off control and the memory of the server
goes through the roof - the performance is also not too good becuase of the
compiling of each page.

If I was to create a code-behind file would this fix my speed and memory
problems? - e.g - The external program only writes unique markup pages and
has an @ directive to referance the same class. The class gets compiled once
- what happens to the markup - does it go and still create another class
based on the code-behind class. Also - if I was to it this this way could I
still use the <%= %> tags to referance the results of functions in the
code-behind class?? Doing it this way would I still end up with the same
problems???

Thanks for your help
 
L

Lucas Tam

I have a problem at the moment where an external program writes aspx
files to a server and then allows people to brows to those pages.
Each aspx page is similiar and is written in a single file - the file
contains both <%= %> attributes and <SCRIPT runat=server> code. Each
file has a unique name.

If you want to write dynamic code... you should take a look at using
CodeDom (just do a google search on dynamic .NET code).

Otherwise, what you're doing will be slow, since .NET has to compile the
code on each run.

Is there a way you can do this without writing dynamic code? It seems very
inefficent... : )
 
S

Steve Lutz

Hello Matthew

I don't know if my solution will help you or not, but instead of creating
many individual aspx files on the server, I would consider using either an
HttpModule or HttpHandler to access these pages. In this way, these actual
pages do not exist.

I would have a "template" page(s) which render themselves like the
individual aspx pages do, except that it pulls data dynamically from
somewhere. This basically replaces the external program that creates aspx
pages.

The httpModule evaluates the URL to determine how to build the page, and
calls server.transfer to the template page.
For example, say the user goes to:
http://mydomain.com/productlisting/product1.aspx
The HttpModule could convert that to
http://mydomain.com/productdisplay.aspx?product=product1

The user will never see the second URL in their browser.

Above, productdisplay.aspx is the template page, and given enough variables
is able to create the same output that the individual .aspx pages had.

In this way, you are not creating hundreds/thousands of files on your
webserver, and everything is still compiled.

HTH

Steve
 
B

Bruce Barker

every aspx page needs to be compiled. a precompiled codebehind file will
save some time (less code).

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top