I want to integrate Azure AD with my existing web form application which is not in mvc.
I want to Authenticate the users with Azure AD and based on that they will able to login into our existing application.
I have found lot's of examples for mvc application's but not for web form applications.
Please help
I have tried below code. but I am getting below response
error=invalid_request&error_description=AADSTS900144%3a+The+request+body+must+contain+the+following+parameter%3a+%27response_type%27.%0d%0aTrace+ID%3a+xxxxxxxx-xxxx-xxxx-xxxx-af348a6f4200%0d%0aCorrelation+ID%3a+f0a33d0c-xxxx-xxxx-xxxx-816e66bdea91%0d%0aTimestamp%3a+2021-08-26+09%3a49%3a18Z&error_uri=https%3a%2f%2flogin.microsoftonline.com%2ferror%3fcode%3d900144#
What I have tried:
var authority = "https://login.microsoftonline.com";
var tenant = "xxxxxxxx-xxxx-xxxx-xxxx-3914728445dc";
var authorizeSuffix = "oauth2";
var EndPointUrl = String.Format("{0}/{1}/{2}/authorize?resource=xxxxxxxx-xxxx-xxxx-xxxx-bd0030e86430", authority, tenant, authorizeSuffix);
var clientId = "xxxxxxxx-xxxx-xxxx-xxxx-bd0030e86430";
var redirectURL = "http://localhost:54321/SignIn.aspx";
var parameters = new Dictionary<string, string="">
{
{ "response_type", "code" },
{ "client_id", clientId },
{ "redirect_uri", redirectURL },
{ "prompt", "login"}
};
var list = new List<string>();
foreach (var parameter in parameters)
{
if (!string.IsNullOrEmpty(parameter.Value))
list.Add(string.Format("{0}={1}", parameter.Key, HttpUtility.UrlEncode(parameter.Value)));
}
var strParameters = string.Join("&", list);
var requestURL = String.Concat(EndPointUrl, strParameters);
Response.Redirect(requestURL);