views:

842

answers:

2

I have Visual Studio 2008 Professional and I am having issues with expanding and collapsing method code blocks in ASP.Net Generic Handler pages (.ashx)

I would have thought you could do the same thing like in the code behind of .aspx web pages.

I have this same issue on other boxes even with VS 2008 Standard and VS 2005 Professional. All boxes have been fully patched (OS and Visual Studio.)

Does anybody have any suggestions as to enabling this feature?

A: 

You can force Visual Studio to ignore the fact that it's code in front you're working with by going to:

Tools | Options

And opening the "Text Editor | File Extensions" tab.

Create a new entry for extension "ashx", mapped to editor "Microsoft Visual C#" (or "Microsoft Visual Basic", as your preference takes you), and "Add" it.

OK the dialog, close and re-open your ashx file, and your code blocks willl collapse to your hearts content, but the @ directive will be rather ugly.

You have the same issue if you have serverside script in the .aspx file (for example in a web site project and you don't "Place code in a seperate file"), then you cannot collapse the class blocks in there either.

Zhaph - Ben Duguid
A: 

Is there no other solution? I tried what you said and the expand/collapse works, BUT I am left with the IDE complaining that the WebHandler directive (@) has errors in the Error List.

PhantomTypist