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

Parsing controls

Hi all
currenly I am trying to load a static file from a the file system in
asp.net and parse it to produce ASP.net controls from the file. In a
quick prototype I have use the Page.ParseControl() method to create the
control and then add it to the page. However I would like to move this
functionallity out to a HttpHandler to decouple this functionally from
the rest of the site.

However, I can't seem to find a way to do this, as the parseControl
method is protected on the page class. Is there somewhere else in the
framework withe this functionallity? I want to build this functionallty
up front, using the Front Controller pattern as the pages themselves do
not need to know anything about the parsed controls. (Sorry I mightn't
be very clear in my explanation.)

Anybody have any ideas?

Thanks in advance

S.
Nov 18 '05 #1
4 1222
"Stirling" <fa*******@NOSPAM.com> wrote in message
news:30*************@uni-berlin.de...
Hi all
currenly I am trying to load a static file from a the file system in
asp.net and parse it to produce ASP.net controls from the file. In a
quick prototype I have use the Page.ParseControl() method to create the
control and then add it to the page. However I would like to move this
functionallity out to a HttpHandler to decouple this functionally from the
rest of the site.

However, I can't seem to find a way to do this, as the parseControl method
is protected on the page class. Is there somewhere else in the framework
withe this functionallity? I want to build this functionallty up front,
using the Front Controller pattern as the pages themselves do not need to
know anything about the parsed controls. (Sorry I mightn't be very clear
in my explanation.)


Have you tried using UserControls (.ascx) files? This is what they're made
for. See Page.LoadUserControl.

John Saunders
Nov 18 '05 #2
My problem is that the static file is produced within a CMS and I have
no control over (the files are outside the boundry of the app). The
content contains ASP server side includes, which need to be parsed
before they are sent to the response. If I am working on a page, I can
do this easily by using the ParseControl() method, however as I said
before I would like to move it out of the Page.

John Saunders wrote:
"Stirling" <fa*******@NOSPAM.com> wrote in message
news:30*************@uni-berlin.de...
Hi all
currenly I am trying to load a static file from a the file system in
asp.net and parse it to produce ASP.net controls from the file. In a
quick prototype I have use the Page.ParseControl() method to create the
control and then add it to the page. However I would like to move this
functionallity out to a HttpHandler to decouple this functionally from the
rest of the site.

However, I can't seem to find a way to do this, as the parseControl method
is protected on the page class. Is there somewhere else in the framework
withe this functionallity? I want to build this functionallty up front,
using the Front Controller pattern as the pages themselves do not need to
know anything about the parsed controls. (Sorry I mightn't be very clear
in my explanation.)

Have you tried using UserControls (.ascx) files? This is what they're made
for. See Page.LoadUserControl.

John Saunders

Nov 18 '05 #3
"Stirling" <fa*******@NOSPAM.com> wrote in message
news:30*************@uni-berlin.de...
My problem is that the static file is produced within a CMS and I have no
control over (the files are outside the boundry of the app). The content
contains ASP server side includes, which need to be parsed before they are
sent to the response. If I am working on a page, I can do this easily by
using the ParseControl() method, however as I said before I would like to
move it out of the Page.


"Move it out of the Page": what exactly do you mean by this? For instance,
did you realize that Page implements IHttpHandler? You can simply declare
your handler as a subclass of Page, without an ASPX file. You then have all
of the facilities of Page to use.

As to server-side includes, those are parsed by IIS normally. Are you
planning to parse them yourself?

John Saunders
Nov 18 '05 #4
Sterling,

Create your own cusomer server control, override the Render method and build
the html output you require in that. You could even then place this in a
user control and set it's output cache property so the file was read only
intermittently greatly improving performce.

About 15-20 lines of code.

Ben Walker
"John Saunders" wrote:
"Stirling" <fa*******@NOSPAM.com> wrote in message
news:30*************@uni-berlin.de...
My problem is that the static file is produced within a CMS and I have no
control over (the files are outside the boundry of the app). The content
contains ASP server side includes, which need to be parsed before they are
sent to the response. If I am working on a page, I can do this easily by
using the ParseControl() method, however as I said before I would like to
move it out of the Page.


"Move it out of the Page": what exactly do you mean by this? For instance,
did you realize that Page implements IHttpHandler? You can simply declare
your handler as a subclass of Page, without an ASPX file. You then have all
of the facilities of Page to use.

As to server-side includes, those are parsed by IIS normally. Are you
planning to parse them yourself?

John Saunders

Nov 18 '05 #5

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

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
21
by: Scott Marquardt | last post by:
What are some good strategic approaches to using freeform text fields for data that needs to be queried? We have a product whose tables we can't change, and I need to count on a "description" field...
2
by: Pumkin | last post by:
Hey guys, It appears to be a very simple problem, but I just cannot realize why it is happening. I have a HTMLTable in which I put 10 labels. Now, I'm trying to parse the collection and to...
1
by: sp | last post by:
i have an xml file (an rss file) <?xml version="1.0" ?> <rss version="2.0"> <channel> <title>CodeGuru.com</title> <link>http://www.codeguru.com/</link> <description>The number one developer...
5
by: Steven Berkovitz | last post by:
I am trying (without any luck) to find a way to parse a string and output its processed results. ie: string text = "This is text from a CMS tool <asp:Label runat=\"server\" id=\"test\"...
4
by: Neil.Smith | last post by:
I can't seem to find any references to this, but here goes: In there anyway to parse an html/aspx file within an asp.net application to gather a collection of controls in the file. For instance...
4
by: =?Utf-8?B?QWxwYW5h?= | last post by:
I am making a thin email client and want to get emails from a pop3 server...Is there any built in support in C# to get emails from a pop3 server and parse the email to show up on the UI ?
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
5
by: arunairs | last post by:
Hi, How would one parse aspx pages? Is there an aspx parser available? I need to access the individual controls in an aspx page and parse them. thanks, Arun
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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,...

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.