Server.URLEncode - Needs Uppercase

Posted on 2009-12-21
Last Modified: 2012-05-08

Right now i am using server.urlencode to encode the value..
Ex. Server.URLEncode("Hello World")
Now it return,

But i want serverUrlEncode to return uppercase value of special characters
(Note values of "%2b" and "%2B" in both sample)

How can i get the uppercase here??
Question by:badalpatel
    1 Comment
    LVL 2

    Accepted Solution

    There is no direct property that return the thing you want here. But you can make your function to achieve the solution.

    Dim RegEx As New Regex("%.{2}")
            Dim Test As String = HttpUtility.UrlEncode("Hello World")
            Dim Eval As New MatchEvaluator(AddressOf FixCase)
            Test = RegEx.Replace(Test, Eval)
        Private Function FixCase(ByVal m As Match) As String
            Return m.Value.ToUpper
        End Function

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now