Andornot Consulting Inc.
Home Page
Home Page
 |  | 

Monday, October 15, 2007

Helpful Visual Studio tip: automatically insert attribute values when typing

In Visual Studio 2005, the default is to not automatically insert attribute value quotes when typing in the HTML editor. I don't like that. If you're like me, change this default behaviour by going to Tools -> Options -> Text Editor -> HTML -> Format. Then check off "Insert attribute value quotes when typing."

Insert attribute value quotes when typing. 

On another note, you'll notice the "Insert attribute value quotes when formatting" checkbox right below. This is on by default; I find it very useful in that one of my favourite shortcut key chords (ctrl-K, ctrl-F) not only formats the selected text, but also then automatically enters any missing attribute value quotes.

Labels: ,

Friday, October 05, 2007

ASP.NET AJAX Funky Exceptions Part II

Back in the summer I described an issue with ASP.NET AJAX. The session solution dealt with things well enough (and note the update to simply disable session in a page-by-page basis for all but the pages requiring reading or writing to the session), but I'm still getting the occasional SystemWeb.HttpException where there's a problem with the RoleManager module:

Server cannot modify cookies after HTTP headers have been sent.

Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie cookie) at System.Web.Security.RoleManagerModule.OnLeave(Object source, EventArgs eventArgs)

Of course, because the user doesn't get what's going on (the user just gets the javascript alert box mentioned previously as I haven't intercepted the ASP.NET AJAX thrown error in this application - for this reason, I will be in all future applications), this exception is usually thrown multiple times until the user navigates to another page and then returns to try again. Some users are quite persistent (I recall one being close to 10 times) which would be humorous if it wasn't just so cruel and bad.

It turns out I've had to disable role caching as per the article I mentioned in the last post until either the ASP.NET Role Manager is fixed or I decide to write/find a custom role module. What's interesting is that the roles are not ever being changed in the pages throwing the exception! Harumph. Back to looking at jQuery from here on in.

Has anyone come up with a solution for this so that the roles data store is not being hit on every page load?

UPDATE: As per the comments below, apparently this has been fixed in ASP.NET 3.5, but there are no plans to back port the fix to 2.0.

Labels: ,