views:

123

answers:

1

I am using OAuth (linq2twitter and DotNetOpenAuth) to allow a user to post comments via their twitter account. So when you do the authorization twitter does a callback, so the way linq2twitter does it is to set the callback to the page that did the req. So if the req came from blah.com\twit it will redirect to blah.com\twit. This leads me to have code like this:

public ActionResult Twit(){
        var qString = Request.QueryString;
        if (qString.Count <= 0){
        //do authorization
        }
        else{
        //do authentication
        }
}

So I would like to split it to this(seemingly both of these calls are done via GET):

 public ActionResult Twit(){}
 public ActionResult Twit(string token1, string token2){}

When I have this currently I get the .net yellow screen complaining about ambiguous action methods. How do I route this?

+1  A: 

You can use AcceptVerbs like this

public ActionResult Twit(){}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Twit(string token1, string token2){}

This will make ASP.NET MVC 2 route to the second action method when the callback is posted.

Gonzalo Quero
It seems like the callback is done via a Get, so both of the methods need to be a get.
arinte
Right. It seems I didn't get the question right. You could try this, then: http://blog.abodit.com/2010/02/asp-net-mvc-ambiguous-match/
Gonzalo Quero