473,398 Members | 2,380 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,398 software developers and data experts.

Aspx's Html Injection



Hi,

I'm try to find an easy efficient way to generate my web pages
dynamically from an xml/text file.

What exactly I want?

I want that whenever a pages is loaded it will go and read an xml/text
file which will include the style of the page (tables,div, web
controls, etc) and will build the page according to that. Meaning that
initially the page ("default.aspx") has no html on it and its
entire html is built on the fly, per request. Please keep in mind that
that text/xml file may include names of webcontrols that will have to
be added to the page as will and will render themselves.

In a nutshell, I'm trying to find a way to inject to an aspx file its
"hard core" html (the html which exist at design time in the aspx
file) before its start to load and render itself. Please keep in mind
that I cannot/don't want to start creating those files on the fly,
hence, no file IO writing.

I there any simple way to implement such a thing?

Any idea would be great,

thanks,

Jun 8 '06 #1
4 2174
> Hi,

I'm try to find an easy efficient way to generate my web pages
dynamically from an xml/text file.

What exactly I want?

I want that whenever a pages is loaded it will go and read an xml/text
file which will include the style of the page (tables,div, web
controls, etc) and will build the page according to that. Meaning that
initially the page ("default.aspx") has no html on it and its
entire html is built on the fly, per request. Please keep in mind that
that text/xml file may include names of webcontrols that will have to
be added to the page as will and will render themselves.

In a nutshell, I'm trying to find a way to inject to an aspx file its
"hard core" html (the html which exist at design time in the aspx
file) before its start to load and render itself. Please keep in mind
that I cannot/don't want to start creating those files on the fly,
hence, no file IO writing.

I there any simple way to implement such a thing?

Any idea would be great,

thanks,


You can have a "PlaceHolder" in you page. You can add all sorts of
controls (including html) to that.

Also look up on the ParseControl method which can turn an "html string"
into a set of controls (you can turn the text of an ascx file into
"live controls").
Hans Kesting
Jun 8 '06 #2
I don't believe there is. The problem here is that it seems that you
don't want to inject HTML, but rather, the ASPX page itself. What I mean by
this is that an ASPX page has HTML in it, but it has tags in it that are
interpreted by the ASP.NET runtime and rendered appropriately.

AFAIK, you can't inject the tag for say, a textbox that is interpreted
on the server and then have ASP.NET interpret it.

Your default.aspx page is going to be rendered based on some condition,
right? Why not just evaluate that condition, and then branch off the HTML
in the page accordingly?

Also, you could put almost all of the logic in the ASPX page itself, and
then change it when you need to. That way, all you have to do is make the
change to the page, and ASP.NET will handle the compilation.

Finally, you will probably get a perf boost doing it this way as well,
since the pages are compiled code (better than reading from the file and
then writing to the stream).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<or*******@gmail.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...


Hi,

I'm try to find an easy efficient way to generate my web pages
dynamically from an xml/text file.

What exactly I want?

I want that whenever a pages is loaded it will go and read an xml/text
file which will include the style of the page (tables,div, web
controls, etc) and will build the page according to that. Meaning that
initially the page ("default.aspx") has no html on it and its
entire html is built on the fly, per request. Please keep in mind that
that text/xml file may include names of webcontrols that will have to
be added to the page as will and will render themselves.

In a nutshell, I'm trying to find a way to inject to an aspx file its
"hard core" html (the html which exist at design time in the aspx
file) before its start to load and render itself. Please keep in mind
that I cannot/don't want to start creating those files on the fly,
hence, no file IO writing.

I there any simple way to implement such a thing?

Any idea would be great,

thanks,

Jun 8 '06 #3
It should be no problem to override the page's render method and build
your page there, but it does seem like you are going to be doing a lot
of programming yourself for no reason. If you are actually going to
read the whole page definition in the xml file then you are in fact
reading the page.

protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
//your code goes here.
}

or*******@gmail.com wrote:
Hi,

I'm try to find an easy efficient way to generate my web pages
dynamically from an xml/text file.

What exactly I want?

I want that whenever a pages is loaded it will go and read an xml/text
file which will include the style of the page (tables,div, web
controls, etc) and will build the page according to that. Meaning that
initially the page ("default.aspx") has no html on it and its
entire html is built on the fly, per request. Please keep in mind that
that text/xml file may include names of webcontrols that will have to
be added to the page as will and will render themselves.

In a nutshell, I'm trying to find a way to inject to an aspx file its
"hard core" html (the html which exist at design time in the aspx
file) before its start to load and render itself. Please keep in mind
that I cannot/don't want to start creating those files on the fly,
hence, no file IO writing.

I there any simple way to implement such a thing?

Any idea would be great,

thanks,


Jun 8 '06 #4
I really agree with the other comments; however a common technique that seems
close to what you describe is to use an Xml Control at the top of the "page",
and supply it dynamically with the xml document and xsl stylesheet document
for the TransformSource. The control will automatically perform the
XslTransform, the result being a complete custom page.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"or*******@gmail.com" wrote:


Hi,

I'm try to find an easy efficient way to generate my web pages
dynamically from an xml/text file.

What exactly I want?

I want that whenever a pages is loaded it will go and read an xml/text
file which will include the style of the page (tables,div, web
controls, etc) and will build the page according to that. Meaning that
initially the page ("default.aspx") has no html on it and its
entire html is built on the fly, per request. Please keep in mind that
that text/xml file may include names of webcontrols that will have to
be added to the page as will and will render themselves.

In a nutshell, I'm trying to find a way to inject to an aspx file its
"hard core" html (the html which exist at design time in the aspx
file) before its start to load and render itself. Please keep in mind
that I cannot/don't want to start creating those files on the fly,
hence, no file IO writing.

I there any simple way to implement such a thing?

Any idea would be great,

thanks,

Jun 8 '06 #5

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

Similar topics

4
by: Leif K-Brooks | last post by:
I'm writing a site with mod_python which will have, among other things, forums. I want to allow users to use some HTML (<em>, <strong>, <p>, etc.) on the forums, but I don't want to allow bad...
3
by: John Baker | last post by:
Hi:7 Newby here to ASP, and using the ASP.NET Web Matrix development tool. While that tool looks great for a Newby, I have run into a snag. I have an HTML Text Box which I have named HireInput,...
5
by: moondaddy | last post by:
I have a website that currently has all static htm pages and nothing will be dynamic for quite some time. This site is made up of a bunch of htm pages. is there any advantage or disadvantage of...
8
by: David C. Stone | last post by:
I'm stuck trying to validate an html 4.01 page that uses an image map. I copied the second client-side example from here: <http://www.w3.org/TR/html401/struct/objects.html#h-13.6> and...
0
by: Hero41Day | last post by:
Hi, I'm try to find an easy efficient way to generate my web pages dynamically from an xml/text file. What exactly I want? I want that whenever a pages is loaded it will go and read an...
8
by: stirrell | last post by:
Hello, One problem that I had been having is stopping email injections on contact forms. I did some research, read up on it and felt like I had created a working solution. I hadn't gotten any...
14
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be...
2
by: Sudhakar | last post by:
A) validating username in php as part of a registration form a user fills there desired username and this is stored in a mysql. there are certain conditions for the username. a) the username...
12
by: shank | last post by:
I've been hit again using DW, parameterized queries and stored procedures. I'm guessing I was not strict enough with character counts and allowing to long of a string to pass. Aside from that,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
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,...

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.