Javascript debugging with visual studio on vista hangs

by Ishai Hachlili 2. February 2008 10:02

Can it be that I'm the only one having this problem? that's what I though until I found another developer who already submitted a bug report to microsoft.

I'm debugging some javascript using Visual Studio 2008 Team System and all of a sudden the IDE hangs, as well as the browser and webserver.
There's no way to get out of it, all I get is a message that asks me if I want to switch back to VS or wait for it to be available, but it won't, no matter how long I wait (I did leave it over night once), so I have to kill the process, it's the only way.

The problem is, this happens in different situations and I can't see any connection other than it's javascript debugging.

This happened to me a couple of times with VSTS 05 on vista, but with 08 it happens a lot


if you're developing on XP, DON'T upgrade to vista, this problem might happen on XP as well (never did to me) but I know vista/vsts/ie7 don't like working together too much.

 and another small issue I have with javascript debugging. VS requires the option to enable debugging in IE7, this means that whenever there's a javascript error in a site I'm browsing to I will see the "do you wish to debug?" message. I didn't know so many sites have bugs, don't people test their sites? a lot of bugs have to do with blocked pop ups.
This is really annoying, and it won't be less annoying to change this option everytime I start/finish debugging something.

The real problem is when opening pages in new tabs, if you open more than one page, and both pages have an error, IE7 just hangs and I have to kill the process. and when you kill the process, the history is lost, so go find that site you were on.

Maybe IE8 will solve this problem, I know that it's coming soon (by MS timetable, that probably means 6-12 months) but a patch to VS would be nice, so it can enable/disable debugging in the browser it opens when I select "view in browser" or start the app

I did submit this feature request to MS


and now, back to debugging, I'm keeping my fingers crossed for a hang free session

Tags: , , , ,


My favorite grid

by Ishai Hachlili 11. October 2007 07:13

When working with AJAX to create a better UI, I like using javascript controls instead of .Net server controls inside update panels.
The Asp.Net GridView is great for normal server-side generated pages but it's not right for client side UI.
I needed a control that allows creating the grid on the client side and supports client side sorting and column drag & drop.

I found this control which does the basic sortable table with drag and drop but it missed some key features.

After a lot of customization, I now have a control that supports links and string formatting on the client side.
I am currently working on clearing up the code and separating it from other features of our system so I can release it (watch this space...)

so if you need a nice little grid view that you can easily customize to your needs, I would go with the WebFX control, I couldn't find any other control that's close to it and this one is free.

Tags: , ,

AJAX | Javascript

The SQL SiteMap Provider and trimming by roles (originally posted 2006-09-20)

by Ishai Hachlili 20. September 2006 15:01

This is a post from my old blog and since I'm about to delete it I've decided to move the post over here, enjoy...

For a while now I've been using the SqlSiteMapProvider from the Wicked Code article by Jeff Prosise.
This provider works great but it was missing a few things, so I decided to improve it a bit.

One of the most common mistakes/confusions about sitemaps in ASP.Net 2.0 is that the Roles attribute in the sitemap will be used to trim these pages for users not in this role. From what I understand, in the providers that ship with ASP.Net 2.0, this attribute is actually used for showing this page links to this roles and not for hiding them from anyone not in those roles.

Another problem with the sitemap is that in order to trim the site navigation controls (TreeView and Menu or any control that uses the SiteMapDataSource) you must set authorization rules in the web.config files by using the <location> section or by having separate web.config files in different folders.

What I wanted to do is have the Roles set on a page in the sitemap control everything.

After looking around for a while, I found that the trimming solution is very simple and easy and it's actually just one override that's missing from the SqlSiteMapProvider.

IsAccessibleToUser is the method that needs to be overridden. This methods gets the HTTP context and the SiteMapNode of the current request.
You can get the User object from the context and the Roles from the SiteMapNode and simply check if the user is in any of these roles using the IsInRole method.

Here's the code:

public override bool IsAccessibleToUser(HttpContext context, SiteMapNode node)
//If Security Trimming is not enabled return true
if (!SecurityTrimmingEnabled)
return true;

//If there are no roles defined for the page
//return true or false depending on your authorization scheme (when true pages with
//no roles are visible to all users, when false no user can access these pages)
if (node.Roles == null node.Roles.Count == 0)
return false;

//check each role, if the user is in any of the roles return true
foreach (string role in node.Roles)
if (context.User.IsInRole(role) String.Equals(role, "*", StringComparison.InvariantCultureIgnoreCase))
return true;

return false;

After adding this code, pages that have roles the user is not in will not be visible in menus and treeviews but the user will still be able to access these pages with a direct URL.
A simple check when the page loads using the SiteMap.CurrentNode.Roles and the User.IsInRole can helps us find out if the user should be able to see this page.
I usually use a base class that all pages inherit from (and that inherits from System.Web.UI.Page), so I simply added the code to the OnLoad method of the base class.
Here's the code:
if (User.Identity.IsAuthenticated)
bool isUserAllowed = false;
if (SiteMap.CurrentNode != null)
if (SiteMap.CurrentNode.Roles != null && SiteMap.CurrentNode.Roles.Count > 0)

foreach (string role in SiteMap.CurrentNode.Roles)
if (context.User.IsInRole(role) String.Equals(role, "*", StringComparison.InvariantCultureIgnoreCase))
isUserAllowed = true;
//no roles for this page, deny access to the page
//if you want to allow access to pages without roles defined set to true

isUserAllowed = false;
if (!isUserAllowed)

After adding these methods you no longer need the <authorization> tags in the web.config file. the data from the UsersInRoles and SiteMap tables will be used instead, allowing full control of page access rules from your application.

Tags: , , ,


About Me

Ishai Hachlili is a web and mobile application developer.

Currently working on Play The Hunt and The Next Line

Recent Tweets

Twitter October 23, 05:22
@BenThePCGuy a standard where that doesn't matter is better. One more reason to get the #Lumia920, wireless charging, no need for microUSB

Twitter October 23, 05:21
@ManMadeMoon where they dance around the issues and don't really talk about them

Twitter October 23, 05:20
@BenThePCGuy are you a @wpdev ?

Twitter October 23, 04:17
@JonahLupton But if it's black it's usually better

Twitter October 23, 02:58
@jongalloway next time ask your 5 year old how to spell