Solved

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

Posted on 2008-06-11
5
277 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 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A Change in PHP Behavior with Session Write Short Circuit (http://php.net/manual/en/book.session.php#116217) (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
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.

862 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

25 Experts available now in Live!

Get 1:1 Help Now