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

I need rewrite this url http://adresa.com/article.php?act=view&id=1113 to http://adresa.com/view/1113 I make it with mod_rewrite in
I need to encode some strings to add to a URL. My string contains
I need to pass an url from asp.net load_page to flowplayer javascript function here:
I need to take a url, /ServiceSearch/r.php?n=blahblah, and have it go to /search/blahblah/ so
I need to parse a URL to get the protocol, host, path, and query
I am retrieving an encoded url via querystring. I need to pass it again
I need some help with this please I can't get a handle on it.
I have a lot of JSON data I need to pass to a request:
In my code, I create a link like this: $link = 'http://www.mydomain.com/'.urlencode($str).'/1'; I use
I have been given some basic documentation of the RazorGator REST API and need

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.