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
17
17
/// <returns></returns>
18
18
public IActionResult AdminConsent ( )
19
19
{
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 ) ;
21
22
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
+ }
23
39
}
24
40
}
25
41
}
You can’t perform that action at this time.
0 commit comments