Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to properly display the info with carriage returns?
Message
De
07/04/2016 04:27:26
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01634462
Message ID:
01634479
Vues:
27
>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');
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform