File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
4-WebApp-your-API/4-3-AnyOrg/TodoListService/Controllers Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,25 @@ public class HomeController : Controller
1717 /// <returns></returns>
1818 public IActionResult AdminConsent ( )
1919 {
20- var queryString = System . Web . HttpUtility . ParseQueryString ( HttpContext . Request . QueryString . ToString ( ) ) ;
20+ var decodeUrl = System . Web . HttpUtility . UrlDecode ( HttpContext . Request . QueryString . ToString ( ) ) ;
21+ var queryString = System . Web . HttpUtility . ParseQueryString ( decodeUrl ) ;
2122 var clientRedirect = queryString [ "state" ] ;
22- return Redirect ( clientRedirect ) ;
23+ if ( ! string . IsNullOrEmpty ( clientRedirect ) )
24+ {
25+ if ( queryString [ "error" ] == "access_denied" && queryString [ "error_subcode" ] == "cancel" )
26+ {
27+ var clientRedirectUri = new Uri ( clientRedirect ) ;
28+ return Redirect ( clientRedirectUri . GetLeftPart ( System . UriPartial . Authority ) ) ;
29+ }
30+ else
31+ {
32+ return Redirect ( clientRedirect ) ;
33+ }
34+ }
35+ else
36+ {
37+ return RedirectToAction ( "GetTodoItems" , "TodoList" ) ;
38+ }
2339 }
2440 }
2541}
You can’t perform that action at this time.
0 commit comments