Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

Using a MVC attribute to confirm identity, rediect to signin, then to original destination

$
0
0
I wrote my own identity attribute for MVC, but it has 1 flaw in it.
So when I create links to the users account, if they haven't logged in, the attribute catches it and redirects them to login.

In the attribute, I change the filter context to RedirectToRouteResult and send them to Login.
But after they login, they return to the original page and not the page I sent them to in the first place.

I guess I'm looking for a way to capture the original destination and pass it to the Login Page, so the controller can move them on their way to the proper destination.
I've seen Amazon do it in a query string. Any thoughts?

So this is a OnActionExecuting call
 
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary{
   { "controller", "Account" },
   { "action", "SignIn" }
});
 
If it ain't broke don't fix it

Viewing all articles
Browse latest Browse all 3938

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>