Response.Output.Write("<{0}>Hello {1}!</{0}>", "h1", "World");

Welcome to my blog. After much prodding and pushing, I have finally caved in and created a blog. The timing is perfect, since pretty much everything in my professional life is in transition right now, the most significant of which is the start of Pluralsight, a new company focused on content development and training. I am also in the process of researching and writing the next version of my book, Essential ASP.NET which targets the next release of ASP.NET, 2.0 (aka Whidbey). I'm really impressed with the array of new features in the next release, and look forward to sharing my findings through this blog over the next few months. Stay tuned!

Update: fixed the missing trailing tag in the title :-)

Update2: (sorry for those of you receiving this post for the 3rd time)  I can't believe I forgot the element tags in my first post and then neglected to fix them in the last update even. Sorry about that - this was the intended title (and should be last update for this post).

Update3: grrrrrrr... this time I was hindered by a .Text encoding problem - this will be the last update.


Posted May 26 2004, 04:08 AM by fritz-onion
Filed under:

Comments

Ruben Bartelink wrote re: Response.Output.Write("{0}Hello {1}!{/0}", "h1", "World");
on 07-05-2004 6:58 AM
s|{\|/{|

I thought the book said to use a TextWriter to avoit this type of problem :)
Fritz Onion wrote re: Response.Output.Write("{0}Hello {1}!{/0}", "h1", "World");
on 07-05-2004 7:11 AM
Ha :) Actually Response.Output is the underlying TextWriter that let's you do things like embed string format placeholders when writing to the response. Unfortunately it doesn't fix silly programmer string formatting problems :~)
Ruben Bartelink wrote re: Response.Output.Write("<{0}>Hello {1}!</{0}>", "h1", "World");
on 07-05-2004 11:40 PM
... I had thought (but not typed) HtmlTextWriter / XmlTextWriter -- I hadnt even noticed the angly brackets being missing...

The code'd be *so* much more elegant, and people would only have to read it one more time!

BTW I cant recall seeing anywhere whether you have plans for an Essential ASP.NET 2.0, can you blog about it please ?
Fritz Onion wrote re: Response.Output.Write("<{0}>Hello {1}!</{0}>", "h1", "World");
on 07-06-2004 2:52 PM
Ah, HtmlTextWriter, of course. Yes, that would clean things up a bit, and would have prevented my error, good point. I'll post an entry on my plans for Essential ASP.NET 2.0 soon, that's a good idea. Thanks!

Add a Comment

(required)  
(optional)
(required)  
Remember Me?