Mercurial > altnet-hispano
diff Agendas/trunk/src/Agendas.Web/Controllers/AccountController.cs @ 206:beeb06da4398
Al querés ingresar a un lugar que requiere autenticación y luego de autenticarse, vuelve a la página donde quería entrar
author | nelopauselli |
---|---|
date | Wed, 24 Aug 2011 10:38:13 -0300 |
parents | 1deccd6c3cb2 |
children | b921a0ab8504 |
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Web/Controllers/AccountController.cs Wed Aug 24 10:19:48 2011 -0300 +++ b/Agendas/trunk/src/Agendas.Web/Controllers/AccountController.cs Wed Aug 24 10:38:13 2011 -0300 @@ -23,15 +23,18 @@ return View(); } - public ActionResult TwitterLogOn() + public ActionResult TwitterLogOn(string returnUrl) { var oAuth = new OAuthTwitter(); if (Request["oauth_token"] == null) { var action = Url.Action("TwitterLogOn"); + if (!string.IsNullOrWhiteSpace(returnUrl)) + action += "?ReturnUrl=" + returnUrl; + var url = Request.Url.Scheme + "://" + Request.Url.Host + - (Request.Url.Port != 80 ? ":" + Request.Url.Port : string.Empty) + action; + (Request.Url.Port != 80 ? ":" + Request.Url.Port : string.Empty) + action; return Redirect(oAuth.AuthorizationLinkGet(url).ToString()); } @@ -58,6 +61,9 @@ personaService.CreateIfNotExist(IdentityProviderEnum.Twitter, username, nombre); _formsService.SignIn(Identification.Map[(int)IdentityProviderEnum.Twitter]+username, false); + + if (!string.IsNullOrWhiteSpace(returnUrl)) + return Redirect(returnUrl); return RedirectToAction("Index", "Home"); }