Solved

Why does string passed to web service in ASP.NET lose carriage return charcters?

Posted on 2008-06-11
5
285 Views
Last Modified: 2013-11-08
I have a web site written in VB ASP.NET that is consuming a web service on another computer over the internet that I have also writeen in VB ASP.NET. The consuming page sends a string to a service subroutine and the string contains chr(13) & chr(10) sequences to form line breaks in a customer address. The service then calls a SQL stored procedure passing the string. The database only ends up with a char(10) the char(13) being lost somehow.

As a test I created a test service that created a customer record using the same method but created its own test address (i.e. not passed over internet) but using the same stored procedure and same calling routine and the database got both the char(10) and the char(13).

How do I avoid the char(13) being lost when the string is passed to the web service?
0
Comment
Question by:BOIT
  • 3
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 21758219
probably because those characters have no representation in HTML. Replace them with <BR>
0
 

Author Comment

by:BOIT
ID: 21758324
No, this is not the problem. The resultant database is being viewed and manipulated by Access not on a web page. The web page is creating the data not viewing it.
0
 
LVL 7

Accepted Solution

by:
Chrisedebo earned 500 total points
ID: 21855351
Web services use XML to transfer data back and forth. The issue could be here. My advice is to check for and add if necessary the chr(13) in the web service after the data has been received but before it's been stored to the db.
0
 

Author Comment

by:BOIT
ID: 21865773
Thanks for the suggestion. I am back on this project in about a week and I will check your suggestion then and get back to you.
0
 

Author Comment

by:BOIT
ID: 22014506
Chrisedebo exactly right the chr(13) seems to be being stripped in the XML.
I inserted code in the web service:

address = replace(address,chr(10),vbcrlf) and then send data to database and all is well.

Thank you for your help.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

679 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