473,386 Members | 1,886 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,386 software developers and data experts.

I need a good solution ASAP!

I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize custom
controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template" page,
or control (but which?). If I use either, how can I a) integrate the server
controls properly; b) load the contents of the page they requested into my
site template file? I was able to do all this with .ASP using an ISAPI
filter to intercept the requests and change the path of the request to (for
example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but
99% of them refer to utilizing web controls. I need this also interact with
..htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad
Nov 18 '05 #1
18 1421
Check out the next version of ASP.Net (code name "Whidbey") which includes
"Master Pages" - very similar to what you're describing.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:#H**************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize custom controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template" page, or control (but which?). If I use either, how can I a) integrate the server controls properly; b) load the contents of the page they requested into my
site template file? I was able to do all this with .ASP using an ISAPI
filter to intercept the requests and change the path of the request to (for example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but
99% of them refer to utilizing web controls. I need this also interact with .htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad

Nov 18 '05 #2
i think you can make a HttpHandler to map the request
and create the content on demand.
for more detail about httpandler, please prefer msdn

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#H**************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize custom controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template" page, or control (but which?). If I use either, how can I a) integrate the server controls properly; b) load the contents of the page they requested into my
site template file? I was able to do all this with .ASP using an ISAPI
filter to intercept the requests and change the path of the request to (for example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but
99% of them refer to utilizing web controls. I need this also interact with .htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad

Nov 18 '05 #3
I know that Whidbey will do this, but I can't wait until 2005! :-) I've
checked out some HTTP Handlers, and I've added a line to my Global.asax file
(see below) that will route requests to "something". The question from here
is, in this "something", such as an aspx or ascx file, how can I "execute"
the page the user actually requested?

Ugh, there has got to be a better way to templating files in ASP.NET!!
Thoughts?

Chad

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Check out the next version of ASP.Net (code name "Whidbey") which includes
"Master Pages" - very similar to what you're describing.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:#H**************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize

custom
controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template"

page,
or control (but which?). If I use either, how can I a) integrate the

server
controls properly; b) load the contents of the page they requested into my site template file? I was able to do all this with .ASP using an ISAPI
filter to intercept the requests and change the path of the request to

(for
example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but 99% of them refer to utilizing web controls. I need this also interact

with
.htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad


Nov 18 '05 #4
Got any good examples? How can I create the content on demand?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
i think you can make a HttpHandler to map the request
and create the content on demand.
for more detail about httpandler, please prefer msdn

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#H**************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize

custom
controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template"

page,
or control (but which?). If I use either, how can I a) integrate the

server
controls properly; b) load the contents of the page they requested into my site template file? I was able to do all this with .ASP using an ISAPI
filter to intercept the requests and change the path of the request to

(for
example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but 99% of them refer to utilizing web controls. I need this also interact

with
.htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad


Nov 18 '05 #5
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize custom controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.


I'm afraid you're not going to get a canned solution for this very soon. The
next version of ASP.NET would help you, but it's not even in beta yet.

It's possible that some of the solutions you found under "asp.net template"
would work for you even with the .htm files. If you set the IIS script
mappings such that .htm files are processed by aspnet_isapi.dll the same as
..aspx files are, then even .htm files will be able to pass through any
HttpHandler or HttpModule you may have.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #6
I guess my next question would be: How can I "read" the content of the
requested file, the integrate it into my .aspx/ascx file, then have the file
compile/execute?

Chad

"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:Ov**************@TK2MSFTNGP10.phx.gbl...
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few
things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do
this?
2. I know I can put custom controls, map .htm/.html files to utilize custom
controls, etc, but I don't want to go through and update 2000 pages (and
growing) to .aspx files and then add the controls.


I'm afraid you're not going to get a canned solution for this very soon.

The next version of ASP.NET would help you, but it's not even in beta yet.

It's possible that some of the solutions you found under "asp.net template" would work for you even with the .htm files. If you set the IIS script
mappings such that .htm files are processed by aspnet_isapi.dll the same as .aspx files are, then even .htm files will be able to pass through any
HttpHandler or HttpModule you may have.
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #7
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:uv**************@TK2MSFTNGP11.phx.gbl...
Got any good examples? How can I create the content on demand?


One very simple way to do this would be to create the .pdf file on the
server, but then have the page send it to the client via Response.WriteFile.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #8
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
I guess my next question would be: How can I "read" the content of the
requested file, the integrate it into my .aspx/ascx file, then have the file compile/execute?


Your handler can use Request.Url to see what file was requested, then
Server.MapPath to find out where it is on disk, then you can read it just
like any other file.

Actually, in this case, you might consider creating a "template" page which
contains an <iframe runat="server" />. Have your handler use
Context.RewritePath to change the path to
template.aspx?page=<originalRequestedHtml>. template.aspx could then set the
src attribute of the iframe to the <originalRequestedHtml>. I seem to recall
that I did that once to put a .pdf file inside of a template page.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #9
you can study .Text project of free source , in this project, the author use
the technology of Httphandler almost every where

you visit the author's blog
http://scottwater.com/blog/

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:uv**************@TK2MSFTNGP11.phx.gbl...
Got any good examples? How can I create the content on demand?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
i think you can make a HttpHandler to map the request
and create the content on demand.
for more detail about httpandler, please prefer msdn

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#H**************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do this?
2. I know I can put custom controls, map .htm/.html files to utilize custom
controls, etc, but I don't want to go through and update 2000 pages (and growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template"

page,
or control (but which?). If I use either, how can I a) integrate the

server
controls properly; b) load the contents of the page they requested into my
site template file? I was able to do all this with .ASP using an
ISAPI filter to intercept the requests and change the path of the request to

(for
example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but 99% of them refer to utilizing web controls. I need this also

interact with
.htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad



Nov 18 '05 #10
another solution, as to the request, you can resolve the request and using
Response.WriteFile(Server.Mappath("filepath")) to response the content of
your html file content to the client, still using Httphandler technology to
handler all the request from client and processing it in a class

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:uv**************@TK2MSFTNGP11.phx.gbl...
Got any good examples? How can I create the content on demand?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
i think you can make a HttpHandler to map the request
and create the content on demand.
for more detail about httpandler, please prefer msdn

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#H**************@TK2MSFTNGP11.phx.gbl...
I am (and have been trying!) to find a good way to do the following few things:

1. When a user requests a .aspx/.htm/.html file, the file needs to be
automatically integrated into a page template. In ASP.NET, how can I do this?
2. I know I can put custom controls, map .htm/.html files to utilize custom
controls, etc, but I don't want to go through and update 2000 pages (and growing) to .aspx files and then add the controls.

Basically, I want to send .aspx/.htm/.html files to a "site template"

page,
or control (but which?). If I use either, how can I a) integrate the

server
controls properly; b) load the contents of the page they requested into my
site template file? I was able to do all this with .ASP using an
ISAPI filter to intercept the requests and change the path of the request to

(for
example) site_template.asp. Any ideas and thoughts would be very much
appreciated.

And yes, I've tried googling asp.net template, and many other queries, but 99% of them refer to utilizing web controls. I need this also

interact with
.htm/.html files in the most efficient manner possible.

Thanks for any help!

Chad



Nov 18 '05 #11
Will this method, Response.WriteFile(Server.Mappath("filepath")), work with
..aspx files also?

Chad

"coollzh" <co*****@hotmai.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
another solution, as to the request, you can resolve the request and using
Response.WriteFile(Server.Mappath("filepath")) to response the content of
your html file content to the client, still using Httphandler technology to handler all the request from client and processing it in a class

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:uv**************@TK2MSFTNGP11.phx.gbl...
Got any good examples? How can I create the content on demand?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
i think you can make a HttpHandler to map the request
and create the content on demand.
for more detail about httpandler, please prefer msdn

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#H**************@TK2MSFTNGP11.phx.gbl...
> I am (and have been trying!) to find a good way to do the following few > things:
>
> 1. When a user requests a .aspx/.htm/.html file, the file needs to be > automatically integrated into a page template. In ASP.NET, how can I
do
> this?
> 2. I know I can put custom controls, map .htm/.html files to
utilize custom
> controls, etc, but I don't want to go through and update 2000 pages (and > growing) to .aspx files and then add the controls.
>
> Basically, I want to send .aspx/.htm/.html files to a "site template" page,
> or control (but which?). If I use either, how can I a) integrate the server
> controls properly; b) load the contents of the page they requested into
my
> site template file? I was able to do all this with .ASP using an

ISAPI > filter to intercept the requests and change the path of the request to (for
> example) site_template.asp. Any ideas and thoughts would be very much > appreciated.
>
> And yes, I've tried googling asp.net template, and many other
queries, but
> 99% of them refer to utilizing web controls. I need this also

interact with
> .htm/.html files in the most efficient manner possible.
>
> Thanks for any help!
>
> Chad
>
>



Nov 18 '05 #12
no , this methold ony apply to the static html or text content.
to .aspx files you can dispatch the request directly to the .aspx files

i think you must to have a .aspx template ,then the basepage.cs is a good
solution for you, you create serval server control for the common content,
and load the controls in your base page. all the exists .aspx.cs extend from
this basepage.cs

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#7*************@tk2msftngp13.phx.gbl...
Will this method, Response.WriteFile(Server.Mappath("filepath")), work with .aspx files also?

Chad

"coollzh" <co*****@hotmai.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
another solution, as to the request, you can resolve the request and using
Response.WriteFile(Server.Mappath("filepath")) to response the content of your html file content to the client, still using Httphandler technology to
handler all the request from client and processing it in a class

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:uv**************@TK2MSFTNGP11.phx.gbl...
Got any good examples? How can I create the content on demand?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:uP**************@TK2MSFTNGP09.phx.gbl...
> i think you can make a HttpHandler to map the request
> and create the content on demand.
> for more detail about httpandler, please prefer msdn
>
> "Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
> :#H**************@TK2MSFTNGP11.phx.gbl...
> > I am (and have been trying!) to find a good way to do the
following few
> > things:
> >
> > 1. When a user requests a .aspx/.htm/.html file, the file needs
to be > > automatically integrated into a page template. In ASP.NET, how
can
I
do
> > this?
> > 2. I know I can put custom controls, map .htm/.html files to
utilize > custom
> > controls, etc, but I don't want to go through and update 2000
pages (and
> > growing) to .aspx files and then add the controls.
> >
> > Basically, I want to send .aspx/.htm/.html files to a "site

template" > page,
> > or control (but which?). If I use either, how can I a) integrate the > server
> > controls properly; b) load the contents of the page they requested

into
my
> > site template file? I was able to do all this with .ASP using an

ISAPI
> > filter to intercept the requests and change the path of the
request to > (for
> > example) site_template.asp. Any ideas and thoughts would be very much > > appreciated.
> >
> > And yes, I've tried googling asp.net template, and many other queries, but
> > 99% of them refer to utilizing web controls. I need this also

interact
> with
> > .htm/.html files in the most efficient manner possible.
> >
> > Thanks for any help!
> >
> > Chad
> >
> >
>
>



Nov 18 '05 #13
Ok, let me see if I'm understanding all this correctly:

1. Add verb to Web.config to route all .htm files to an aspx file. In
there, I will load the base class(es) and use
Response.WriteFile(Server.Mappath("filepath")) (should this go in the code
behind, or how would I do this without putting inline code in the HTML?)
2. Set up all .aspx files to inerit the base class .vb (or .cs) file.

Also, do you (or anyone) know of a way to not include the
<head></head><body></body> tags when the .aspx file is loading the "child"
aspx file controls?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
no , this methold ony apply to the static html or text content.
to .aspx files you can dispatch the request directly to the .aspx files

i think you must to have a .aspx template ,then the basepage.cs is a good
solution for you, you create serval server control for the common content,
and load the controls in your base page. all the exists .aspx.cs extend from this basepage.cs

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#7*************@tk2msftngp13.phx.gbl...
Will this method, Response.WriteFile(Server.Mappath("filepath")), work

with
.aspx files also?

Chad

"coollzh" <co*****@hotmai.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
another solution, as to the request, you can resolve the request and using Response.WriteFile(Server.Mappath("filepath")) to response the content of your html file content to the client, still using Httphandler technology
to
handler all the request from client and processing it in a class

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:uv**************@TK2MSFTNGP11.phx.gbl...
> Got any good examples? How can I create the content on demand?
>
> Chad
>
>
> "coollzh" <co*****@hotmai.com> wrote in message
> news:uP**************@TK2MSFTNGP09.phx.gbl...
> > i think you can make a HttpHandler to map the request
> > and create the content on demand.
> > for more detail about httpandler, please prefer msdn
> >
> > "Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
> > :#H**************@TK2MSFTNGP11.phx.gbl...
> > > I am (and have been trying!) to find a good way to do the following few
> > > things:
> > >
> > > 1. When a user requests a .aspx/.htm/.html file, the file needs to
be
> > > automatically integrated into a page template. In ASP.NET, how can
I
do
> > > this?
> > > 2. I know I can put custom controls, map .htm/.html files to

utilize
> > custom
> > > controls, etc, but I don't want to go through and update 2000

pages (and
> > > growing) to .aspx files and then add the controls.
> > >
> > > Basically, I want to send .aspx/.htm/.html files to a "site

template"
> > page,
> > > or control (but which?). If I use either, how can I a)

integrate the
> > server
> > > controls properly; b) load the contents of the page they
requested into
> my
> > > site template file? I was able to do all this with .ASP using an ISAPI
> > > filter to intercept the requests and change the path of the

request
to
> > (for
> > > example) site_template.asp. Any ideas and thoughts would be

very much
> > > appreciated.
> > >
> > > And yes, I've tried googling asp.net template, and many other

queries,
> but
> > > 99% of them refer to utilizing web controls. I need this also
interact
> > with
> > > .htm/.html files in the most efficient manner possible.
> > >
> > > Thanks for any help!
> > >
> > > Chad
> > >
> > >
> >
> >
>
>



Nov 18 '05 #14
I'm not necessary worried about .pdf files, more about .htm/.html and aspx
files. I want to "invisibly" template the page, not use a querystring setup
(such as you mentioned of template.aspx?page=<originalRequestedHtml>. I
would like for everything to appear "transparently", but also load up the
controls and other content properly. Also, I don't want to have to worry
about the darn <html><head></head><body></body></html> problems. When the
..htm files are uploaded to the server, I don't want to have to remove those
on every page every time they are uploaded/updated.

Ideas?

(Thanks!)

Chad
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:O4****************@TK2MSFTNGP10.phx.gbl...
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
I guess my next question would be: How can I "read" the content of the
requested file, the integrate it into my .aspx/ascx file, then have the file
compile/execute?


Your handler can use Request.Url to see what file was requested, then
Server.MapPath to find out where it is on disk, then you can read it just
like any other file.

Actually, in this case, you might consider creating a "template" page

which contains an <iframe runat="server" />. Have your handler use
Context.RewritePath to change the path to
template.aspx?page=<originalRequestedHtml>. template.aspx could then set the src attribute of the iframe to the <originalRequestedHtml>. I seem to recall that I did that once to put a .pdf file inside of a template page.
--
John Saunders
johnwsaundersiii at hotmail

Nov 18 '05 #15
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Will this method, Response.WriteFile(Server.Mappath("filepath")), work with .aspx files also?


No, but I believe that the <iframe> method might work. You'd have to be
careful that your handler doesn't recurse!
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #16
to htm files, you can directly response.WriteFile()
to aspx files ,you can can use basepage inherited by other aspx.cs file

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:ug*************@TK2MSFTNGP11.phx.gbl...
Ok, let me see if I'm understanding all this correctly:

1. Add verb to Web.config to route all .htm files to an aspx file. In
there, I will load the base class(es) and use
Response.WriteFile(Server.Mappath("filepath")) (should this go in the code
behind, or how would I do this without putting inline code in the HTML?)
2. Set up all .aspx files to inerit the base class .vb (or .cs) file.

Also, do you (or anyone) know of a way to not include the
<head></head><body></body> tags when the .aspx file is loading the "child"
aspx file controls?

Chad
"coollzh" <co*****@hotmai.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
no , this methold ony apply to the static html or text content.
to .aspx files you can dispatch the request directly to the .aspx files

i think you must to have a .aspx template ,then the basepage.cs is a good
solution for you, you create serval server control for the common content, and load the controls in your base page. all the exists .aspx.cs extend

from
this basepage.cs

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
:#7*************@tk2msftngp13.phx.gbl...
Will this method, Response.WriteFile(Server.Mappath("filepath")), work

with
.aspx files also?

Chad

"coollzh" <co*****@hotmai.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl...
> another solution, as to the request, you can resolve the request and

using
> Response.WriteFile(Server.Mappath("filepath")) to response the
content of
> your html file content to the client, still using Httphandler technology to
> handler all the request from client and processing it in a class
>
> "Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
> :uv**************@TK2MSFTNGP11.phx.gbl...
> > Got any good examples? How can I create the content on demand?
> >
> > Chad
> >
> >
> > "coollzh" <co*****@hotmai.com> wrote in message
> > news:uP**************@TK2MSFTNGP09.phx.gbl...
> > > i think you can make a HttpHandler to map the request
> > > and create the content on demand.
> > > for more detail about httpandler, please prefer msdn
> > >
> > > "Chad A. Beckner" <Ch*********@ProspectiveLink.com> дÈëÏûÏ¢ÐÂÎÅ
> > > :#H**************@TK2MSFTNGP11.phx.gbl...
> > > > I am (and have been trying!) to find a good way to do the

following
> few
> > > > things:
> > > >
> > > > 1. When a user requests a .aspx/.htm/.html file, the file
needs to
be
> > > > automatically integrated into a page template. In ASP.NET,
how can
I
> do
> > > > this?
> > > > 2. I know I can put custom controls, map .htm/.html files to
utilize
> > > custom
> > > > controls, etc, but I don't want to go through and update 2000

pages
> (and
> > > > growing) to .aspx files and then add the controls.
> > > >
> > > > Basically, I want to send .aspx/.htm/.html files to a "site
template"
> > > page,
> > > > or control (but which?). If I use either, how can I a)

integrate the
> > > server
> > > > controls properly; b) load the contents of the page they requested > into
> > my
> > > > site template file? I was able to do all this with .ASP using an > ISAPI
> > > > filter to intercept the requests and change the path of the

request
to
> > > (for
> > > > example) site_template.asp. Any ideas and thoughts would be very much
> > > > appreciated.
> > > >
> > > > And yes, I've tried googling asp.net template, and many other
queries,
> > but
> > > > 99% of them refer to utilizing web controls. I need this also
> interact
> > > with
> > > > .htm/.html files in the most efficient manner possible.
> > > >
> > > > Thanks for any help!
> > > >
> > > > Chad
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #17
In that case, I think you'll have to write your own HttpHandler. The down
side is, it may take awhile to design and build it. The upside is, you have
total control over how it operates.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:el**************@tk2msftngp13.phx.gbl...
I'm not necessary worried about .pdf files, more about .htm/.html and aspx
files. I want to "invisibly" template the page, not use a querystring setup (such as you mentioned of template.aspx?page=<originalRequestedHtml>. I
would like for everything to appear "transparently", but also load up the
controls and other content properly. Also, I don't want to have to worry
about the darn <html><head></head><body></body></html> problems. When the
.htm files are uploaded to the server, I don't want to have to remove those on every page every time they are uploaded/updated.

Ideas?

(Thanks!)

Chad
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:O4****************@TK2MSFTNGP10.phx.gbl...
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
I guess my next question would be: How can I "read" the content of the requested file, the integrate it into my .aspx/ascx file, then have
the file
compile/execute?


Your handler can use Request.Url to see what file was requested, then
Server.MapPath to find out where it is on disk, then you can read it just like any other file.

Actually, in this case, you might consider creating a "template" page

which
contains an <iframe runat="server" />. Have your handler use
Context.RewritePath to change the path to
template.aspx?page=<originalRequestedHtml>. template.aspx could then set

the
src attribute of the iframe to the <originalRequestedHtml>. I seem to

recall
that I did that once to put a .pdf file inside of a template page.
--
John Saunders
johnwsaundersiii at hotmail


Nov 18 '05 #18
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:el**************@tk2msftngp13.phx.gbl...
I'm not necessary worried about .pdf files, more about .htm/.html and aspx
files. I want to "invisibly" template the page, not use a querystring setup (such as you mentioned of template.aspx?page=<originalRequestedHtml>. I
would like for everything to appear "transparently", but also load up the
controls and other content properly. Also, I don't want to have to worry
about the darn <html><head></head><body></body></html> problems. When the
.htm files are uploaded to the server, I don't want to have to remove those on every page every time they are uploaded/updated.
The query string will not be visible to your users. This is a server-side
URL rewrite.
--
John Saunders
johnwsaundersiii at hotmail
"John Saunders" <jo**************@notcoldmail.com> wrote in message
news:O4****************@TK2MSFTNGP10.phx.gbl...
"Chad A. Beckner" <Ch*********@ProspectiveLink.com> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
I guess my next question would be: How can I "read" the content of the requested file, the integrate it into my .aspx/ascx file, then have
the file
compile/execute?


Your handler can use Request.Url to see what file was requested, then
Server.MapPath to find out where it is on disk, then you can read it just like any other file.

Actually, in this case, you might consider creating a "template" page

which
contains an <iframe runat="server" />. Have your handler use
Context.RewritePath to change the path to
template.aspx?page=<originalRequestedHtml>. template.aspx could then set

the
src attribute of the iframe to the <originalRequestedHtml>. I seem to

recall
that I did that once to put a .pdf file inside of a template page.
--
John Saunders
johnwsaundersiii at hotmail


Nov 18 '05 #19

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

Similar topics

4
by: Philip D Heady | last post by:
I'm in need of a good PHP programmer to help me with my lodgings website asap. Someone who can work on it during the day for a few hrs while I'm at work would be great. Prefer they live in USA...
1
by: whisper | last post by:
Medium/small site with mod_python and sqllite or mySQL running Python 2.3.3 or later on Apache 2.x. I can do the python and CGI, but might need a _little_ hand holding for the rest. Will also...
5
by: Witless | last post by:
This is 'supposed' to be a simple problem and shouldn't need too much time to solve :S Below is a function that works like this: int fn(int input) { int x=(input/8);
3
by: Corey Dyke | last post by:
K here's the situation, attached is a copy of the lab i have due next week. But I won't be around for the next few days, so I 've gotta get it done ASAP. but it's driving me crazy. We have to...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
5
by: phez.asap | last post by:
I am new to Python but come from a C++ background so I am trying to connect the dots :) . I am really liking what I see so far but have some nubee questions on what is considered good form. For one...
0
by: jgill | last post by:
Hello, To start with here is the code: Public Function Paymentget (s12MoRate) strCompanyCode = objXML.selectSingleNode("policy/companyCode").text strState =...
4
by: daxco21 | last post by:
I have been working on this simple project for a week, and come to the point where I feel like I need outside help. For the life of me I can't figure out what is wrong with this "sellIceCream(...)"...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...
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...

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.