How to setup 2 actions with the same name, 1 Authorized and 1 not Authorized?

Is it possble to have something like this in ASP.NET MVC...

public string AddData(string Issues, string LabelGUID)
    return "Authorized";

public string AddData()
    return "Not Authorized";

So if the user is not logged in, it defaults to the un-Authorized action.


Yes, its possible. You would need to create your own ControllerActionInvoker and override the FindActionMethod member. I'd let the base class do it's work and then check to see if the method it returns satisfies your criteria and if not, return a better match.

I'm doing something like this to allow my Controllers to have a "Default Action" and it works well. Check out MvcContrib and their implementation of their ActionInvoker for a really nice example.

Need Your Help

Fetching related parent objects in a chain in Django

django foreign-keys models relation

As always, please forgive my ignorance. I promise I searched first.

Unable to add overlay to MPMoviePlayerController in SDK 4.1


This is a follow-on from: Overlay on top of Streaming MPMoviePlayerController