FormsAuthentication.GetRedirectUrl() returns only first parameter

B

Brian Adkins

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
 
B

Brian Adkins

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top