No.
Having dropped the topic allowing some tags (not really a question), HtmlEncode just DOES NOT cover all XSS attacks.
For example, consider the client-side javascript created by the server - the server dynamically outputs htmlencoded values directly to javascript on the client side, htmlencode will not stop , the script entered from the executable file.
Next, consider the following pseudo-code:
<input value=<%= HtmlEncode(somevar) %> id=textbox>
Now, if it is not immediately visible, if somevar (sent by the user, of course) is set, for example, to
a onclick=alert(document.cookie)
net result
<input value=a onclick=alert(document.cookie) id=textbox>
that would clearly work. Obviously, this could be (almost) any other script ... and HtmlEncode will not help.
There are several additional vectors that need to be considered ... including the third taste of XSS, called DOM-based XSS (where a malicious script is generated dynamically on the client, for example, based on # values).
Also do not forget about attacks like UTF-7 - where the attack looks like
+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-
Nothing special about the encoding ...
Of course, the solution (in addition to correctly and restrictively checking the whitelist input) is to perform context-sensitive encoding: HtmlEncoding is great if you develop an IS HTML context or maybe you need JavaScriptEncoding, or VBScriptEncoding, or AttributeValueEncoding, or ... etc.
If you use MS ASP.NET, you can use their Anti-XSS library, which provides all the necessary context encoding methods.
Please note that all encoding should not be limited to user input, but also stored values from the database, text files, etc.
Oh, and don't forget to explicitly set the encoding, both in the HTTP header and in the META tag, otherwise you will still have UTF-7 vulnerabilities ...
For more information and a fairly definitive list (constantly updated), check out the RSnake Cheat Sheet: http://ha.ckers.org/xss.html