
jerryt.05976 (Customer) asked a question.
I am having trouble getting the Okta login window to appear in my “test” MVC app. When I click my login link, I get this error:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed.....
Requested URL: /login.aspx
I followed the docs on Adding OKTA Authentication to an Aspnet application.
I setup the application in okta with these parameters:
Sign-in redirect URIs: http://localhost:8080/authorization-code/callback
Sign-out redirect URIs: http://localhost:8080/UserAccount/Logout
Initiate login URI: http://localhost:8080/
My web.config has these application settings:
<add key="okta:ClientId" value="myApplicationClientID" />
<add key="okta:ClientSecret" value="myApplicationSecretValue" />
<add key="okta:OktaDomain" value=https://dev-myaccountinfo.okta.com />
<add key="okta:RedirectUri" value=http://localhost:8080/authorization-code/callback />
<add key="okta:PostLogoutRedirectUri" value=http://localhost:8080/useraccount/PostLogout />
I added this to my Home page:
@if (Context.User.Identity.IsAuthenticated)
{
<p>Hello, <b>@Context.User.Identity.Name</b></p>
}
else
{
<li>@Html.ActionLink("Sign In", "Login", "UserAccount")</li>
}
My UserAccountController.cs Login() method is set like this:
public ActionResult Login()
{
if (!HttpContext.User.Identity.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.Challenge(
OktaDefaults.MvcAuthenticationType);
return new HttpUnauthorizedResult();
}
return RedirectToAction("Index", "Home");
}
I added an OWIN startup class as suggested. And the Configuration() method is run when the app starts.
When I start my app and click the login link, the Login() method is called in my UseraccountController. But when this line is hit, I get the above error: return new HttpUnauthorizedResult()
The docs say I should see the Okta hosted login form.
What am I missing?

Hello, @jerryt.05976 (Customer)
Feel free to post this question on our Okta Developer Forums: https://devforum.okta.com,
and they should be able to help you with this.
Vicente
Okta,Inc