3

I need to pass the Query String of ID in which colon (:) is included i.e. ABC_PD:123456. When I am using this ID in query String session and when its redirect to another page in URL it give 404 no error found error on webpage.

So can any one provide the solution for this so that I can pass the colon in query string and when Page will be redirect without 404 error.

Solution would be much appreciated.

2
  • 1
    Which language do you use? C# or VB.NET? Commented Feb 9, 2014 at 6:54
  • @Markus: I am using C# Commented Feb 9, 2014 at 9:44

1 Answer 1

6

When you build the URL that you redirect to, you need to encode special characters by using the UrlEncode-method:

var redirectTo = "/mypage.aspx?id=" + HttpUtility.UrlEncode("id123:456");

This will create a query string that looks like this and will be interpreted correctly:

"/mypage.aspx?id=id123%3A456"
Sign up to request clarification or add additional context in comments.

Comments

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.