Max Tenenbaum

Max Tenenbaum

  • NA
  • 33
  • 47.8k

This web page has a redirect loop

Aug 19 2011 6:05 AM

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;
    }            

%>


Answers (6)