Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. /r is removed from string parameter

/r is removed from string parameter

Scheduled Pinned Locked Moved C#
csharpdotnet
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rock Star
    wrote on last edited by
    #1

    Hi all, I am passing a string parameter to one of the method of web service. This string parameter has /r and/n incorporated in it, but when value is passed to web service it removes /r from it. Any reason why is it happening so. Web service is created using .Net framework 1.1 and written in C# code. I am trying to consume web service in an another application build using framework 1.1. Rock Star

    B R J 3 Replies Last reply
    0
    • R Rock Star

      Hi all, I am passing a string parameter to one of the method of web service. This string parameter has /r and/n incorporated in it, but when value is passed to web service it removes /r from it. Any reason why is it happening so. Web service is created using .Net framework 1.1 and written in C# code. I am trying to consume web service in an another application build using framework 1.1. Rock Star

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      Do you have the source code of that web service? Is it running on some OS where new lines are not \r\n but \n only? (Assuming that you actually meant \r and \n when you wrote /r and /n...)

      1 Reply Last reply
      0
      • R Rock Star

        Hi all, I am passing a string parameter to one of the method of web service. This string parameter has /r and/n incorporated in it, but when value is passed to web service it removes /r from it. Any reason why is it happening so. Web service is created using .Net framework 1.1 and written in C# code. I am trying to consume web service in an another application build using framework 1.1. Rock Star

        R Offline
        R Offline
        Ron Beyer
        wrote on last edited by
        #3

        If you want to have the \r and \n come across as literals (not return and newline), then you need to escape them before they get to the server. You can do this in two ways, either:

        string escapedString = "This is my escaped \\r and escaped \\n value";

        or

        string escapedString = @"This is my escaped \r and escaped \n value";

        1 Reply Last reply
        0
        • R Rock Star

          Hi all, I am passing a string parameter to one of the method of web service. This string parameter has /r and/n incorporated in it, but when value is passed to web service it removes /r from it. Any reason why is it happening so. Web service is created using .Net framework 1.1 and written in C# code. I am trying to consume web service in an another application build using framework 1.1. Rock Star

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          Probably depends on what "parameter" means but presuming that you really do have a web 'method' and you are passing data in the body, not url, and the server is discarding it then there is nothing that you can do on the client side that will stop that unless you can find a server side feature that allows it. As per the other suggestion the server might allow escaping but that won't help unless it actually converts the value to the appropriate character. If it doesn't then it will return with the escape intact which won't help you. Of course if you can modify the server then that would solve it.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups