raoul1034
raoul1034

Reputation: 187

Working with query strings

I just integrated a single sign-on provider into my application, which is now sending a query string parameter when it redirects back to the requested page, which causes the page to not load. The way it is set up is:

My Index method looks like this:

public ActionResult Index(string ticket)

which I thought would accept the query string parameter. I am using the default route configuration, that is:

routes.MapRoute(
    // Route name
    "Default", 
    // URL with parameters
    "{controller}/{action}/{id}", 
    // Parameter defaults
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
);

Upvotes: 0

Views: 195

Answers (1)

Andras Zoltan
Andras Zoltan

Reputation: 42343

There is clearly something screwy about this - because there is no good reason why this should not work.

I'll bet if you take off the [Authorize] attribute you'll find that it works with the ?ticket=[value] bit in the Url.

If so, then I reckon Forms auth is getting stuck in a redirect loop (and the browser, after a while will simply refuse to continue) - I think it's not treating the current User as IsAuthenticated=true and so redirects to your SSO. The SSO says that the user is logged in and so redirects with the ticket parameter - ad nauseam.

You can debug this simply with the VS debugger and breakpointing your action method. Equally debugging at the Http level is often easier: download Fiddler and then hit your site using the special name http://ipv4.fiddler instead of http://localhost once it's up and running.

There must be more to your code that you haven't included, though - presumably somewhere you have code that intercepts the ticket and sets the user to be authenticated before the MVC action method kicks in? If so - I reckon that's failing.

Upvotes: 1

Related Questions