Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5961893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:01:47+00:00 2026-05-22T19:01:47+00:00

I need to URL encode some periods since I have to pass some document

  • 0

I need to URL encode some periods since I have to pass some document path along and it is like this

http://example.com/test.aspx?document=test.docx

So test.docx is causing me an error of an illegal character. So I need to change it to

.  -->  %2E

I tried to use Server.UrlEncode

  string b = Server.UrlEncode("http://example.com/test.aspx?document=test.docx");

but I get

"http%3a%2f%2fexample.com%2ftest.aspx%3fdocument%3dtest.docx"

So do I have to use like a string replace and do it manually and replace all periods with that code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:01:48+00:00Added an answer on May 22, 2026 at 7:01 pm

    The period there isn’t he problem (given that %2E doesn’t solve the problem). A period is a perfectly valid URL character whatever the problem is it’s not the period. Check the stack trace of the error being throw or post the complete error details.

    And you shouldn’t be URL encoding the entire path. Only the query string parameter value.

    string b = "http://example.com/test.aspx?document=" + Server.UrlEncode("test.docx");
    

    Are you still getting the error if you try it that way?

    I wouldn’t touch SharePoint with a ten foot pole. However, escaping the period wouldn’t necessarily stop SharePoint from doing it’s shenanigans. But I guess you should at least try it.

    Server.UrlEncode("test.docx").Replace(".", "%2E");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need a function like: function isGoogleURL(url) { ... } that returns true iff URL
I need to do a few very simple URL manipulations in Java. Like get
I need to set up some RewriteRules to redirect a URL which has a
I need to URL encode a non-latin string (japanese, chinese, or just non ascii
In my code, I create a link like this: $link = 'http://www.mydomain.com/'.urlencode($str).'/1'; I use
I need to store a url in a MySQL table. What's the best practice
I need to test a url that it does not end with .asp So
I need to POST data to a url in the middle of a script.
I need to be able to get at the full URL of the page
I need to build a function which parses the domain from a URL. So,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.