how to override the rendering method of a whole asp.net applicaction?

  • Thread starter Thread starter Ricardo Quintanilla G.
  • Start date Start date
R

Ricardo Quintanilla G.

how to override the rendering method of a whole asp.net applicaction? i want
to not include spaces between html elements.

As example, then rendering produce that:

== == == ==
<html>
<body>
<p>Welcome</p>
<p>to my app</p>
</body>
</html>
== == == ==


and i would like then rendering would by:
== == == ==
<html><body><p>Welcome</p><p>to my app</p></body></html>
== == == ==

do you see?
no spaces between html elements
 
Hello Ricardo,

I think what you want is to intercept the response content of all the pages
in your ASP.NET web appliation and do some customization on the response
content(removing the whitespaces),correct?

Based on my experience, generally to intercept the page's response content
and customize it, we mostly override individual page's Render method.
However, if you want to intercept the response of all the pages in the web
application, I think you can consider using the response Filter of the
HttpResponse. The HttpResponse class provide a "Filter" property which
allow us to chain a wrapper Stream object to the HttpResponse's Stream,
thus we can use this custom stream object to intercept the response's
content and do some simple customization. Here is an article describing
this:

#Producing XHTML-Compliant Pages With Response Filters
http://www.aspnetresources.com/articles/HttpFilters.aspx

BTW, in order to apply this filter(custom stream) onto all the page
response, you can use Global.asax event or use a custom httpmodule to
install the filter on each page response object. (also mentioned in the
above article).

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Back
Top