asp.net remove white space in html

  • Thread starter Thread starter Aaron
  • Start date Start date
Aaron said:
is there a way to remove all white spaces in the html output? ie. everything
as one line.

Well, Response.Filter is where I'd start:

http://msdn.microsoft.com/library/d...rlrfSystemWebHttpResponseClassFilterTopic.asp

But I don't know eliminating all whitespace is what you'd do, cuz you'd
have to figure out how to detect if you were inside of a tag (don't want
to just erase all spaces, etc.). You wouldn't strip out whitespace like
that.

But you could strip out things like Tab characters (if this is what you
meant). crlf's I thought were problematic when I tried it for a client
(for their pages), but I can't think of why (I thought it caused
problems in Javascript. As long as every line ends with ; the JS should
still run fine. Unless you use the <!-- // --> wrapper around
scripts, as I don't think this can go all on the same line. Example:

<script language="javascript">
<!--
alert('hello');
// -->
</script>
 
It sounds like he only wants to filter out line breaks, for whatever reason.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 

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

Similar Threads

white space removal tools? 3
HTML Optimization for asp.net outputs 2
HTML White Space from Hidden Controls 4
Automatically Compact HTML on render 4
Validation White Spaces 3
remove space 1
Windows 10 One Drive Problem 2
regular expression 1

Back
Top