Hi,
Can someone inspect the following code and tell me why I am getting the following error message:
"This web page has a redirect loop"
Code behind: proposal.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
ActiveDirectoryHelper.ActiveDirectoryHelper adh = new ActiveDirectoryHelper.ActiveDirectoryHelper();
string loginName = Page.User.Identity.Name.Split('\\')[1];
ADUserDetail ThisUser = adh.GetUserByLoginName(loginName);
if (ThisUser.Company == "co1)")
{
Response.Redirect("Proposal.aspx?Company=One");
}
else if (ThisUser.Company == "co2")
{
Response.Redirect("Proposal.aspx?Company=two");
}
else if (ThisUser.Company == "co3")
{
Response.Redirect("Proposal.aspx?Company=three");
}
}
Main page: proposal.aspx
<%
string Company = Request.QueryString["Company"];
switch (Company)
{
case "one":
Response.Write("Proposal content is for Company1");
break;
case "two":
Response.Write("Proposal content is for Company2");
break;
case "three":
Response.Write("Proposal content is for Compnay3");
break;
}
%>
Can someone inspect the following code and tell me why I am getting the following error message:
"This web page has a redirect loop"
Code behind: proposal.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
ActiveDirectoryHelper.ActiveDirectoryHelper adh = new ActiveDirectoryHelper.ActiveDirectoryHelper();
string loginName = Page.User.Identity.Name.Split('\\')[1];
ADUserDetail ThisUser = adh.GetUserByLoginName(loginName);
if (ThisUser.Company == "co1)")
{
Response.Redirect("Proposal.aspx?Company=One");
}
else if (ThisUser.Company == "co2")
{
Response.Redirect("Proposal.aspx?Company=two");
}
else if (ThisUser.Company == "co3")
{
Response.Redirect("Proposal.aspx?Company=three");
}
}
Main page: proposal.aspx
<%
string Company = Request.QueryString["Company"];
switch (Company)
{
case "one":
Response.Write("Proposal content is for Company1");
break;
case "two":
Response.Write("Proposal content is for Company2");
break;
case "three":
Response.Write("Proposal content is for Compnay3");
break;
}
%>

VulpesRank #55 · 29.2K reputationPosted Aug 19, 2011, 2:53 AM EDT
Satish BhatRank #2,496 · 563 reputationPosted Aug 19, 2011, 2:17 AM EDT
If error is only happening in Google Chrome, solution is to clear cookies and site data.
REF
Max Tenenbaum32 reputationPosted Aug 19, 2011, 2:25 AM EDT
Satish BhatRank #2,496 · 563 reputationPosted Aug 19, 2011, 3:29 AM EDT
VulpesRank #55 · 29.2K reputationPosted Aug 19, 2011, 3:42 AM EDT
The code I added was to make sure that he only redirected to a different page.
Satish BhatRank #2,496 · 563 reputationPosted Aug 19, 2011, 4:26 AM EDT