Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to properly display the info with carriage returns?
Message
From
07/04/2016 04:27:26
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01634462
Message ID:
01634479
Views:
28
>Hi everybody,
>
>I have the following markup:
>
>
><div class="alert alert-danger" ng-show="alertType === 'serverError'">
>                <button type="button" class="close" ng-click="alertType=''" data-dismiss="!alertType==='serverError'">
>                <span aria-hidden="true">×</span><span class="sr-only">@Labels.close</span></button>
>                <i class="fa fa-exclamation-circle fa-2x"></i>
>                {{ alertMessage }}
>            </div>
>
>I am generating the HttpResponseException with this code
>
>throw new HttpResponseException(
>                    Request.CreateErrorResponse(HttpStatusCode.InternalServerError, response));
>
>
>
>The response string contains carriage returns which are displayed as
>\n\r
>
>on the page instead of the normal breaks. What is the proper way to handle this situation?
>
>Thanks in advance.

You need to convert '\r\n' to '\n'. Where you do it depends on what else consumes the web call.
On the server side:
response.Replace(Environment.NewLine,"\n");
On the browser end:
var result: string = alertMessage.replace('\r\n', '\n');
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform