Auth0 sso with ASP.NET web forms application

Hello,

I’ve seen several topics asking for help integrating Auth0 with web forms, but no definitive answers. I’m new to Auth0 and need to create an Auth0 sso in the context of a CMS that uses web forms. I’ve been able to get the ASP.NET OWIN quickstart working as a standalone application, but that’s in the context of MVC, and I’m having trouble converting it to the web forms setup.

I’ve seen references in other posts to a quickstart at https://auth0.com/docs/quickstart/webapp/aspnet?_ga=2.77895252.1992548236.1618944137-474974035.1616102836, but it looks like that no longer exists.

Right now one of my biggest questions is how to translate this code block from the account controller in the MVC quickstart. I’ve been unable to get the redirect to Auth0 to work in web forms, and HttpUnauthorizedResult only exists in MVC:

public ActionResult Login(string returnUrl)
{
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties
{
RedirectUri = returnUrl ?? Url.Action(“Index”, “Home”)
},
“Auth0”);
return new HttpUnauthorizedResult();
}

Thank you for any suggestions or assistance anyone can provide.

1 Like