Visual Studio inserting indents as spaces to html output
I am using Visual Studio 2010 for an MVC website project. I have an big problem and dont know hot to solve it. When i am looking to the output of html in firebug indents in my aspx and ascx files are outputed as space in same places. I think its about line ending of files开发者_如何学Go but i am not sure how to fix them. I am adding some pictures about problem.
When i am adding a breakpoint it also add red background to spaces (this is problem) I try to delete spaces after hit ctrl+k d same problem happen. If i delete all indents make page 1 line without spaces output is fine but it not a solution.
ASPX/ASCX engine emits literal content within markup as is i.e if your file has spaces or tabs for indentation then they will be output as is. You can use Tools->Options for keeping tabs (instead of space) for indents - you can change for all languages or say only for HTML. VS 2010 has a great extension Productivity Power Tools that will (apart from other things) warn you if your file has tabs & space mix and allows you to choose either tabs or spaces.
Now as a better solution, you can use HttpModule to remove whitespace from your response - see http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx
精彩评论