Thursday, June 28, 2007

Windows Live Writer Test

I'm writing this post using my freshly downloaded and installed copy of Windows Live Write (Beta).  I've talked about using ScribeFire in the blog before - I was impressed initially but have since been disappointed by the quality of the posts it makes to Blogger.

So, we'll see how Live Writer handles formatting and such.  Couple of neat things I've noticed so far, that were missing in ScribeFire:

  • You can goto the View menu and choose to see the HTML Code for your post, A "Web Layout" mode that gives you your post in a WYSIWYG format using the style sheet you have applied to your blog, and even a "Web Preview" mode that shows you what your post should look like if inserted into your blog as is.
  • The "tags" (categories WLW calls them) support seems to be good, and seems to incorporate the tags I have already used on my Blogger blog.
  • You can insert all sorts of neat stuff (Pictures, Links, Tables, Maps) and even extend what you can insert by downloading Insert plugins from Windows Live Gallery.  I saw the "Insert from Visual Studio" plugin and had to have it right away.  Lets try it out.

Here is some code inserted using "Insert from Visual Studio" plugin:


    /// <summary>
/// Grabs an integer parameter from the HttpContext.Current.Request
/// </summary>
/// <param name="sParam">The name of the parameter</param>
/// <returns>The int parameter, or -1 if there was no such parameter.</returns>
public static int GetIntParameter(string sParam)
{
int iOut = -1;
if (HttpContext.Current.Request.QueryString[sParam] != null)
{
string sOut = HttpContext.Current.Request[sParam].ToString();
if (!String.IsNullOrEmpty(sOut))
int.TryParse(sOut, out iOut);
}
return iOut;
}

Awesome!  It pasted in just fine, but my layout was too narrow, so the code was wrapping in places it shouldn't.  So, I switched over the HTML source view on WLW and wrapped the whole thing in a <div> and gave it some width. (WLW handled me typing that <div> just now too - another thing to note).  Anyhow, once I gave the div a style="width: 100%", I could switch back to the Web Layout view and click on the div, and drag it's size around using drag handles.  Was not expecting that, but it's pretty neat!


Alright, time to post this thing and see if WLW can make the actual post look as nice as the WYSIWYG view it is giving me.  Then, I'll test the update post capabilities of WLW (if there are any) to let you know.


Update: Ok, doing the update was pretty easy.  Using the "Open" dialog, you can see posts that were recently edited in WLW, or you can even click the Blog view button to edit posts that are already posted using other means.


Everything looked great on the actual blog too!  The only small issue was that my inserted Code block had a noticeably bigger space below it in Firefox than in WLW WYSIWYG view.  I'm going to try changing the height on the <div> I wrapped that in. 


PS: Looks like you can do Technorati tags with this too:


Technorati Tags: , ,

Wednesday, June 27, 2007

Ending an ASP.NET Response during processing.

Your ASP.NET 2.0 page is in the middle of processing a Request (thus creating a Response), when all of the sudden you need to stop the request. Why? Well, say you just called:


FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();


And now you need the current Response to stop processing (no more event handlers to fire, etc). How do you do that? That's the question I had for some time, but didn't have time to investigate it further. After familiarizing myself more with the objects in HttpContext.Current, It became more obvious with where I needed to look, and there it was:


HttpContext.Current.Response.End();


The description says that this method "Sends all currently buffered output to the client, stops execution of the page, and raises the EndRequest event." Nice.

Disqus for A Nofsinger's Blog