Re: FormsAuthentication.GetRedirectUrl() returns only first parameter

From: Brian Adkins (brian)
Date: 02/24/04


Date: Tue, 24 Feb 2004 14:41:47 -0500

I was able to create a workaround that I've included below, but if anyone
has additional insight into this problem, please post to the group.

StringBuilder redirectUrl =
 new StringBuilder(FormsAuthentication.GetRedirectUrl("", false));

NameValueCollection coll = Request.QueryString;

foreach (string key in coll.AllKeys)
{
 if (string.Compare(key, "returnurl", true) != 0)
 {
  String[] values = coll.GetValues(key);

  if (values.Length > 0)
  {
   string pair = key + "=" + values[0];

   if (redirectUrl.ToString().IndexOf(pair) < 0)
   {
    redirectUrl.Append("&" + pair);
   }
  }
 }
}

"Brian Adkins" <brian> wrote in message
news:ex08LHm%23DHA.1212@TK2MSFTNGP12.phx.gbl...
> It appears that FormsAuthentication.GetRedirectUrl() only returns the
first
> parameter for the original target URL. For example, if the original
target
> URL is:
>
> /MyPage.aspx?a=b&c=d
>
> and the user is redirected to the login page, a call to
> FormsAuthentication.GetRedirectUrl() in the login page returns:
>
> /MyPage.aspx?a=b
>
> Any ideas as to why this may be?
>
> Thanks,
>
> Brian Adkins
> http://www.MLSClassified.com
>
>