I need to authorize users programatically.
I have the authorize attribute around my controller:
[Authorize]
public class ProductsController : Controller
In another controller action, I'm invoking a webservice which returns an account number if successful. If not, it will return an error. Basically if the if condition is true I want to authorize user across the rest of the site.
if (!string.IsNullOrEmpty(response.AccountNumber))
{
//Write code to Authorize user to use the rest of the site...
then redirect to a page on my site.
}else
{
//not authorized,
}
The users of the site will be admins.
Thanks