How to compile and run ashx file in visual studio?

I have

  • ashx file,
  • Visual Studio 10,
  • Don't know at all about C # ASP.NET

What is the correct way to compile and run this?

Context

This ashx file can be found in this zip and is a demo application for the AI Tetris Competition . This is a very tempting idea, even if it depends a lot on luck, and I thought I could use this occasion to learn a new language.

+2


source to share


4 answers


The file ashx

is just a generic HTTP handler, so the easiest way to get this working is to create a new website from the File menu and simply add the file Handler.ashx

to the website root.



Then just start the site (F5) and go to " YourSite/Handler.ashx

".

+6


source


An ASHX file is similar to an ASPX file, but it is a handler. This means that it does not respond to HTML by default and therefore may "process" otherwise unprocessed file types, but this is not necessarily related to this value. In this case, you will only present the answer

position=8&degrees=180

      

... to the published board and chunk. Therefore you don't need HTML, therefore you want ASHX.



You can make .ashx files the start page in your project, just like .aspx pages. If I were writing the HelloUser.ashx page, I could set it as the start page, with some parameters passed as querystrings or whatever.

You will probably need some test wiring that will send the board / part to your service, and that could be any project. Command line program, website, test class run through NUnit, whatever. There is a lot of logic to keep track of the "player" logic.

If you need a more detailed answer, then SO might not be the place for this question. But I wish you all the best with that - it's an interesting problem.

+4


source


You need to deploy it on an IIS server with the .NET framework installed and it should be.

If you are trying to get it working locally, create a website project in visual studio, go to "add existing items" in solution explorer and find your ashx. Then click the play button (or press F5) to compile and run it.

Good luck!

+2


source


You are missing some form (maybe an ASPX file) that comes with this handler. It looks like this thing is probably handling some AJAX request from another page.

Also expected 2 pieces of data with the request:

string board = context.Request.Form["board"];
string piece = context.Request["piece"];

      

You can redesign the form as needed, but it will probably take a while to get the right pane.

0


source







All Articles