Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7793665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:33:33+00:00 2026-06-01T22:33:33+00:00

Here’s the relevant (C#.NET) code: WebRequest webRequest = System.Net.WebRequest.Create(authenticationUrl); UTF8Encoding encoding = new UTF8Encoding();

  • 0

Here’s the relevant (C#.NET) code:

WebRequest webRequest = System.Net.WebRequest.Create(authenticationUrl);

UTF8Encoding encoding = new UTF8Encoding();

...

var webResponse = webRequest.GetResponse();
var webResponseLength = webResponse.ContentLength;
byte[] responseBytes = new byte[webResponseLength];

webResponse.GetResponseStream().Read(responseBytes, 0, (int)webResponseLength);
var responseText = encoding.GetString(responseBytes);
webResponse.Close();

Here’s what the value of responseText looks like (as copied from Visual Studio while debugging the above code):

"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<responseblock version=\"3.67\">\n  <requestreference>X3909254</requestreference>\n  <response type=\"ERROR\">\n    <timestamp>2012-04-16 13:53:59</timestamp>\n    <error>\n      <message>Invalid field</message>\n      <code>30000</code>\n      <data>baseamount</data>\n    </error>\n  </response>\n</responseblock>\n"

Why are there seemingly escape characters (e.g. \") in the response? Is this due to the way in which I’m converting the response stream to a string? What should I do instead (so that the value stored in the variable responseText can be parsed as ‘standard’ XML)?

UPDATE – some more code that I was using:

var resultXML = XElement.Parse(responseText);

...


int errorCode = (int)(resultXML.Element("error").Element("code"));

The problem was that the element error isn’t a direct child of the root element of resultXML, hence my apparent inability to reference error (or its child element code).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:33:35+00:00Added an answer on June 1, 2026 at 10:33 pm

    You see these characters only while debugging. I guess the purpose is that you can copy the whole string and insert it directly into C# code for further testing. Also, it’s to be able to represent the whole string as one line.

    But all the \n‘s will be converted to real line breaks when you access the string in your code. So you can safely parse it.

    P.S. Why are you invoking the web request manually? Visual Studio will generate the stub code for you if you use the “Add Web Reference” feature in your solution tree. Then you don’t have to care about XML – you’ll work with objects Visual Studio generates basing on the WSDL description.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
Here is my code, which takes two version identifiers in the form 1, 5,
Here is my persistence.xml : <?xml version=1.0 encoding=UTF-8?> <persistence xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd version=1.0>
Here's my procedure: DROP PROCEDURE IF EXISTS `couponExpires`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `couponExpires`(IN couponID BIGINT,
Here is my problem : I have a post controller with the action create.
Here is an example: I write html code inside of textarea, then I swap
Here's my Manifest: <?xml version=1.0 encoding=utf-8?> <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.mappp.mobile android:versionCode=1 android:versionName=1.0 > <supports-screens android:largeScreens=true
Here is a scenario: User installs .NET application that you have made. After some
Here is my code...I have two dimensional matrices A,B. I want to develop the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.