How to make outputed html source compact in asp.net - asp.net

Visited http://www.12titans.net/p/s/register.aspx, right click view source on the page .I found the html source so compact,have no blank. How to do like this in asp.net?
I am use IE8 ,tks in advance! sorry for my bad english!

I have the same problem with debugging some spring mvc projects, What i normally do is use chrome, right click on the page and inspect element. The element explorer is the source code with javascript applied to it, so i might be a little different, but normally for the better
hope this answer your question.

When you generate HTML using ASP.NET, just don't insert tabs or line breaks or spaces in the source code, and when you code HTML by hand, do the same thing.
In other words, do it by hand.
You can also use a DOM Parser which should be able to get the bare necessities and print it out without any tabs or whitespace.

Related

load html in flex 3.5 and more

I want to load some html page see this in Flex 3.5 or more I followed this tutorial but somehow i think it only works in Flex 2, I even tried by unchecking Generate HTML wrapper file but no luck. Can somebody help me? Thanks
search about iFrame in FLEX application will give you the best result. I have used iFrame but still not get the expected result so i have ignored that thing to implement in my project but might be you can get better result. Best Luck. Have a nice day.
one of the advice from my senior i get is "when you are passing from the firewall you can't get the result in iFrame." so this sentence might be useful to you.
Sorry to dissapoint you, but HTML with Inner Frame and Flex is not a good option.
If you want a wysiwyg html editor, I suggest you to create your own editor, or you can buy one.
And if you need to open a new window of contents, you should open a new window in the HTML way, outside the Flex App.
My experience in IFrames with Flex was with this google code. Some people have modified it and posted it, and you should find in other sites, doing the same thing: It works in some cases, but, for example, will not work if you need to put more complex needs in your App along with IE compatibility.
I used this Guide to make it work. (mostly about adding wmode="opaque" to the html)
Download the flexiframe from this location
Use xmlns:flexiframe="http://code.google.com/p/flex-iframe/" in your component
and <flexiframe:IFrame id="iFrame" label="Google" source="http://www.google.com" width="100%" height="100%" />
That's it.. this worked for me and surprisingly it works on IE, Firefox and chrome
Note: You can also use pdf

Using HTML Tidy with ASP.NET Tags

I've discovered a very nice tool for cleaning up a mess of HTML in a project I have inherited:
HTML Tidy at http://infohound.net/tidy/
Basically, I can paste in my HTML, click the Tidy button, and it cleans everything up.
However, my project is an ASP.NET web site, and HTML Tidy does not know what an asp tag is.
Therefore, by default, it simply removes it.
Ouch! Suddenly, nothing works because I have no controls on my form.
Looking at the Help and going into Advanced features, I set the Output format to Side by Side Diff, which will display the asp tags, is something, but now the two halves do not appear to be very related.
Is there a way, using the web interface, that I can get HTML Tidy to output the items it does not understand?
If not, is there another tidy tool for ASP.NET pages that will not cut out all of my asp tags?
The closest question I found related to this was .NET version of HTML Tidy?, but there could be better answers that did not pull up in my search.
Tidy assumes you want to output valid HTML, so it doesn't play nice with ASP.NET server side tags. If you're just looking for something to indent your html, try http://tools.arantius.com/tabifier.
I found the best editor is to just configure all of the very elaborate settings from within Visual Studio's HTML Text Editor Options.

Disable auto-close HTML tagging in FreeTextBox for ASP.NET

Recently I have run into a bit of a problem with FreeTextBox for ASP.NET. Every time I open a HTML tag in the HTML editor view, if I switch to the design view and come back the tag is automatically closed. This happens when pasting text into the box as well. This is a real problem, I don't want the tag to close automatically, is there any method that can be used to stop this I have looked through the documentation but can't find anything to prevent auto-closing tags.
I'm sorry to tell you that, sometime, the answer is "No, you can't do that".
The only way can I see to do this is by altering the source code. There's a Distribution License that allow you download and modify the code to fit your needs, but there is no easy way out.

Is it possible to use HTML5 in a ASP.NET MVC project in Visual Studio 2010?

For now, I just want to use the <audio> and <video> tags and maybe try out the drag and drop features since these are supported by Firefox 3.6. The project will just be a test project, not necessarily for production.
The big idea behind ASP.NET MVC is that you have total control over the generated HTML, so you just need to use the tags as you wish, no additional work required.
I wanted a bit more control over the inputs and the ability to use postback on the controls, so I built a suite of HTML 5 Controls. It's got canvas and just about all of the new input types. As was said earlier, one big limitation is the browser your user brings to the site. The inputs will fail gracefully to Input Type="text".
Change the DOCTYPE on your master page to
<!DOCTYPE html>
and ignore any validation errors you get. I think you'll be ok.
Absolutely. You can output whatever HTML you'd like.
The HtmlHelpers may not output your desired HTML but its not that hard to change them.
Yes just change the doctype. but the question is does your users have a browser that supports HTML5 ?

What's the best way to remove (or ignore) script and form tags in HTML?

I have text stored in SQL as HTML. I'm not guaranteed that this data is well-formed, as users can copy/paste from anywhere into the editor control I'm using, or manually edit the HTML that's generated.
The question is: what's the best way of going about removing or somehow ignoring <script/> and <form/> tags so that, when the user's text is displayed elsewhere in the Web Application, it doesn't disrupt the normal operation of the containing page.
I've toyed with the idea of simply doing a "Find and Replace" for <script>/<form>with <div> (obviously taking into account whitespace and closing tags, if they exist). I'm also open to any way to somehow "ignore" certain tags. For all I know, there could be some built-in way of saying (in HTML, CSS, or JavaScript) "for all elements in <div id="MyContent">, treat <form> and <script> as <div>.
Any help or advice would be greatly appreciated!
In terms of sanitising user input, form and script tags are not the only ones that should be cleaned up.
The best way of doing this job depends a little on what tools you are using. Have a look at these questions:
What’s the best method for sanitizing user input with PHP?
Sanitising user input using Python
It depends on which language you're using. In general, I'd recommend using an HTML parser, constructing a small DOM from the snippet, then nuking unwanted elements. There are many good HTML parser, especially designed to handle real-world, messy HTML. Examples include BeautifulSoup (Python), HTMLParser (Java)... And, since the answer came in while I was typing, what Colin said!
Don't try and do it yourself - there are far too many tricks for getting bits of script and general nastiness into a page. Use the Microsoft AntiXSS library - version 3.1 has HTML sanitation built in. You probably want the GetSafeHTMLFragment method, which returns a sanitised chunk of HTML. See my previous answer.
Since you're using .Net I would recommend HtmlAgilityPack as it is easy to work with and works well with malformed HTML.
Though the answers suggested were acceptable, I ended up using a good old regular expression to replace begin and end <script> and <form> tags with <div>'s.
txtStore.Text=Regex.Replace(txtStore, "<.*?>", string.Empty);
I had faced same problem before. But my scenario was something different. I was adding content with ajax request to page. The content coming in ajax response was html and it also included script tags. I just wanted to get html without any script so I did removed all script tags from ajax response with jquery.
jquery-remove-script-tags-from-string

Resources