0

I'm using Response.Redirect to to refresh a page with a parameter appended to the end of the URL but for some reason the parameter is being moved to a different part of the URL.

Here's an example, my URL is http://domain.com/en/members/careers/vacancies/?output=html

I want this URL to refresh with the following: http://domain.com/en/members/careers/vacancies/?output=html&param=1

I want to include the extra parameter so I used the following function:

string url = CurrentPage.LinkURL;
Response.Redirect(url+"?output=html&param=1");

Yet when the page refreshes it has redirected to the following URL: http://domain.com/en/?output=html/members/careers/vacancies/

I have no idea why the the output parameter is being put there after /en/ or where my second parameter has gone.

I've been at this for a few hours and I'm going crazy looking at it, any suggestions on this would be greatly appreciated. Thanks!

2
  • What is the value of CurrentPage.LinkURL? Commented Jun 25, 2015 at 14:28
  • Outputted the value and I got /Templates/Members/Pages/JobListingPage.aspx?id=95415&epslanguage=en this might have something to do with URL rewriting Commented Jun 25, 2015 at 15:16

1 Answer 1

1

Maybe try this instead of CurrentPage.LinkURL. Also in you Response.Redirect take out the "?output=html" as it will already be in your string

string URL = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;
Response.Redirect(URL + "&param=1");
Sign up to request clarification or add additional context in comments.

1 Comment

This does work better thanks, however as this includes the original parameter it means that if I use the function more than once I end up with duplicated parameters e.g &param=1&param=1 but this alright I can make a workaround for this. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.