I want to create ASP.NET web page which will prompt me basic authentication popup where in I will enter credentials. I tried adding below lines of code in PreInit and PreLoad event handlers but still it is not showing me basic authentication popup.
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
Response.Headers.Add("WWW-Authenticate", "Basic");
}
protected override void OnPreLoad(EventArgs e)
{
base.OnPreLoad(e);
Response.Headers.Add("WWW-Authenticate", "Basic");
Response.AppendHeader("WWW-Authenticate", "Basic");
}
Can you please help me with this ? Thanks in advance.