c# - ASP.NET MVC URl Routing: How to deal with ?Action=Test parameter -
I have to implement a simple webapp for a simple game for an online competition. I need to get a request and respond to it.
I thought, just use a bare ASP.NET MVC app and handle it URL.
The problem is, the URL I want to handle is:
http://myDomain.com/bot/?action=DoThis&Foo=Bar Public Performance Index (string action, string foo) {if (action == "doo") {return content ("end" ); } And {return material (action); }}
The problem is that string action is always set as the action name of the path I always get:
action == "Index"
It seems that the ASP.NET MVC action parameter overrides the input, and uses the actual ASP. Net MVC Action
Because I can not change the format of the URL that I have to handle: Is there any way to get the parameter correctly?
Take action from the street address, old school:
String action = request .QueryString ["verb"];
You can then run a statement on a case / if it is run
public action result index (string foo) {string action = Request.QueryString [" Action "]; If (action == "doo") {return content ("finished"); } And {return material (action); }}
This is an extra line, but it is a very simple solution with a slightly upper part.
Comments
Post a Comment