0

The problem i am facing is that whenever i add new item and choose Generic Handler file.The "place code in separate file" option is disabled as a result the handler file appears inside other files. I am using visual studio 10.enter image description here

So when i see the solution explorer the handler file is inside default.aspx file just like default.aspx.cs file.Here is the picture of it.

enter image description here

See the handler file is inside the Default.aspx file.
What i want is to have this handler file in the root directory just like test.aspx file as in the picture.

user35
  • 468
  • 1
  • 9
  • 24
  • Sorry, but I really do not understand what is the issue from your comments – Aristos Jul 06 '14 at 11:33
  • ok let me edit it a bit to make it more clear. – user35 Jul 06 '14 at 11:44
  • It is on the root, and they did not need to open anything because you call it as `file.ashx` – Aristos Jul 06 '14 at 12:13
  • I need generic handler file just like any other .aspx file having its own .ashx.cs file so that i can create object of any .aspx.cs class and use them on .ashx.cs file. Like i can do Default mydef = new Default(); and create a new object of default class inside the ashx file.But with handler file itself inside the Default.aspx,i am not able to create object of Default inside .ashx file. – user35 Jul 06 '14 at 17:16

1 Answers1

0

Generic handlers did not have html code, they are the most simple programming method that asp.net can provide to send back a replay.

This is done only using one file, that contains only c# and there you place your replay to the browser.

Some examples:
ASP server stats for html pages
file download by calling .ashx page
HttpContext.Current.Session is null in Ashx file

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150
  • I am not getting what you are trying to say.Can't we add generic handler file in asp.net websites as a separate file.I mean the file is offcourse separate but not in the root of project.when we add an .aspx,it is kept separate which can be extended to get its corresponding .aspx.cs file.But this .ASHX file when added is also placed inside .aspx file. – user35 Jul 06 '14 at 11:17