i create a generic handler (ashx) but i am trying to add region in my code like the following
#region MyRegionName
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
#endregion
there is no error but the problem that there is no expand and collapse.
please any advice ?
note: i am using visual studio 2010
hi i think i figure out the answer my self
in visual studio go to:
1- Tools -> option -> select Text Editor.
2- in the right pane add an extension "ashx" and choose from the drop down list which editor u use .. i select microsoft visual c#.
3- in the bottom check on "map extensionless to : the same selection above.
4- click ok and close the ashx page and reopen it.
thx every body for the answers
This is by design, see the explanation here: http://forums.asp.net/t/1162769.aspx#1928580.
The problem is, that the ashx file is not handled by the C# editor but by the ASP.NET editor.
EDIT: Hang on a minute - I've just re-read your question. An .ashx file, like an .asmx or .aspx file is a markup file, not a code file. You can't use regions in these files. You can use regions in the code behind files associated with them (e.g. the .ashx.cs files) only.
Original Answer: Generally, whenever I get these sort of unexplained odd behaviours in VS2010, I reset all the settings, which normally resolves the issue.
Try Tools->Import and Export Settings->Reset All Settings and see if that fixes your region issue.
If not, it may be related to a bad add-in or extension. Try disabling extensions/add-ins to see if that fixes your problem, alternatively try starting up in safe mode and see if the IDE behaves:
DEVENV.EXE /safemode
Hope this helps.
#region yourRegionName
//your code
#endregion