.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

quotes in xml strings

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net

I need to post an xml string to another website.  I can't create an xml file, because some of the content is dynamically created.  The two lines that are causing me problems are

sPostData = sPostData & "<?xml version='1.0'?>"
sPostData = sPostData & "<?qbmsxml version='4.1'?>"

The receiving site expects to see

<?xml version="1.0"?>
<?qbmsxml version="4.1"?>


<?xml version='1.0'?>
<?qbmsxml version='4.1'?>

The conversion from double quotes to single quotes isn't being accepted.  So how can I send the string so that the versions are surrounded by double quotes?

View Complete Post

More Related Resource Links

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

how To Insert the single quotes in sqlcommand in asp.net


Hi all

    i am developed on simple user registeration application in that i gave  address field .when i am trying to enter something like this (1st main,b'lore) but wont take while inserting.

my query is

sqlcommand cmd=new sqlcommand("insert into registeration_form(name,address)values('"+txtname.text+"','"+txt_address+"')",con);

how can i pass the  quotes also to my query please if any one know reply me.


G Dinakaran

Protect It: Safeguard Database Connection Strings and Other Sensitive Settings in Your Code


Protecting application secrets, such as database connection strings and passwords, requires careful consideration of a number of pertinent factors such as how sensitive the data is, who could gain access to it, how to balance security, performance, and maintainability, and so forth. This article explains the fundamentals of data protection and compares a variety of techniques that can be used to protect application settings. The author discusses what to avoid, such as hiding keys in source code and the use of Local Security Authority. In addition, he presents some effective solutions such as the Data Protection API.

Alek Davis

MSDN Magazine November 2003

ActiveX and Visual Basic: Enhance the Display of Long Text Strings in a Combobox or Listbox


The combobox and listbox controls in Visual Basic have no built-in support for displaying text strings that are too long to fit in the visible area of either control. This article describes several techniques to improve the readability of long strings in each control. The first technique uses tooltips to display a combobox or listbox item. The other techniques, which use various Windows APIs, include adding a horizontal scrollbar for a listbox and determining the necessary width of the longest string given the font attributes of the text. The required steps are described for both comboboxes and listboxes.

John Calvert

MSDN Magazine December 2000

two adjacent double quotes in json causes blue screen by JavaScriptSerializer

Hello, I am using System.Web.Script.Serialization.JavaScriptSerializer to deserialize  http requests.  I get the blue screen when the contents I am deserializing has two double quotes, for example:  ""country"". Is there a fix for this?  Currently I replace the "" with a special string and then I deserialization, then I put back the "".  I do this for a given field in the object which I've seen comes in with ""s.  The problem is that I should be doing this for all fields in the input json.  This is a lot of extra code to write as I could be deserializing many different types of Json objects.  The "" is needed by the client to specify a quoted string, so I can't ask for the input to be changed. Any help on this subject would be really appreciated. Many thanks.     I am using .Net framework 3.5.

PropertyOf and INotifyPropertyChanged.PropertyChanged without strings

When coding applications using design patterns such as MVP (Model-View-Presenter) or MVVM (Model-View-ViewModel), you'll find yourself using data binding and the INotifyPropertyChanged interface all over the place. This means referencing properties quite a lot. For example, when you want to notify that the value of a property has changed, you can write NotifyPropertyChange("SomeProperty") where NotifyPropertyChange is a method that invokes the INotifyPropertyChanged.PropertyChanged event. The major inconvenience of using a string to reference a property name, as in NotifyPropertyChange("SomeProperty"), is that it's a very brittle approach. If the name of the property changes or the property is removed during some refactoring operation on the source code, then it's easy to forget to update all the "string references". Luckily, solutions exist to avoid this kind of issues. infoof => PropertyOf, FieldOf, MethodOf, ConstructorOf We don't have propertyof or infoof operators in C# (see 1, 2, 3 or 4), but we can use things such as PropertyOf thanks to expression trees. You can learn more about such an approach on the C# FAQ blog and Patrick Smacchia's blog. Here is the source code, derived from the above articles, that I use in a utility class: Snippet public static MethodInfo MethodOf<T>(Expression<Func<T>> expression){  var&

Error calling WCF service that is returning list.".Debugging resource strings are unavailable ......

Ok.this is just making me frustrated... Here is step by step of what I am trying to do (& not able to) 1. I am calling WCF service hosted in a SharePoint 2010 site from a silverlight app in same domain (So no cross doman I guess). 2. I use Linq to Sharepoint for querying the DB. 3. I am having a list "machines" in Sharepoint 2010 that is having a lookup column from Other list called "part" 4. My WCF method GetAllMachines() works perfectly well when it skips the lookup column "partname" & returns List of type machineitem. 5. But problem occurs when I add machineitemobject.parts.partsname in my Linq to Sharepoint query . My service gives the error not found Async_ExceptionOccurred] Arguments: Debugging resource strings are unavailable." 6. Note that return type of my Method is List<machinesitem> 7. The point to note here is that I use SPMETAL tool to generate the LINQ class that maps the lists . So When I try to query the lookup column it tries to add List item of the type class & that is what causing the error. Is it because I am not using datacontract in my service (but it returns the strings & all private members of machines list e.g. name,title etc) Is it making the attribute Serialisable will solve the error ??? I am kind of lost in it ...Plss help!!   Thanks

Newer version of UnDouble to assist wih quotes in 2008

I found references to the downloads below which assist in parsing data with double-double quotes in it. Are there SSIS2008 versions of these components? I can't fin them. http://www.microsoft.com/downloads/details.aspx?familyid=b51463e9-2907-4b82-a353-e15016486e1d http://www.microsoft.com/downloads/details.aspx?FamilyID=9c624eab-6893-4734-b5dd-f80d0d487aa1  http://www.microsoft.com/downloads/details.aspx?familyid=91e24d1d-acf0-45b1-a9a5-9ea1c7bd0463 DylanBack of the net...

Unique quotes site Sharepoint 2010

Hello. Sharepoint Server 2010 Standart. There are sites collection, with a quota template to 5Gb. Some sites require different quotes than the rest of the family. Question: how these sites change the quota template to a non-quota template the entire sites collection. Structure: sitecollection (quoteSC) | site1 (inherits quoteSC) | site 1.1 (inherits quoteSC) | site 1.1.1 I want custom quote for this site!

Subtracting from Strings

I am writing a windows form which requires putting all the words in a textbox in an array. Everything is fine except the backspace function. Obviously, when the user hits backspace, I want it to remove the last character typed; however, I keep getting errors when I subtract from a string... here's the code (it's in c++ but I'm fine if I get code samples in other programming languages from you) it is in a key down event handler for textBox1   if(e->KeyCode != Keys::Space && e->KeyCode != Keys::Back && e->KeyCode != Keys::ShiftKey) { input[j] += e->KeyCode.ToString(); } if(e->KeyCode == Keys::Back) { if(input[j] == "") { j--; } else { String^ theText = input[j]; int i = theText->Length - 1; input[j] = input[j] - theText[1].ToString(); } } if(e->KeyCode == Keys::Space) { j++; } //j is an int and input is a string array  

Simple Regex. Select 2 strings in a sentence

Hello,  I am a begginer in Regular expressions. I am trying to write a regex to print out a specific string in a sentence.  For example:  "We've found questions similar to yours" I would like to create a regex for the word "found" and "yours". whenever found is matched OR yours is matched print the word.  Basically i just need to know how the OR statement works in this case.  regex.match("found" OR "yours")  ??? Thank you -Klevis

Strings stripped of leading whitespace when using MTOM message encoding

Hello, I have a problem which I believe is actually caused by a bug in WCF 4 (.Net 4). I have a WCF service exposes two basicHttpBinding endpoints identical in everything but the message encoding used, one uses "text" and one "mtom" (i.e. the values for the messageEncoding attribute on the binding configuration). If I send a string with leading whitespaces to the "text endpoint" it is delivered to the service application code exactly as sent. If I send the string to the "mtom endpoint" it is stripped of the leading whitespaces before being handed over to the service application code. I have confirmed that the leading whitespaces are included in the message on the wire and using an IDispatchMessageInspector I have also confirmed that the whitespaces are still present after decoding the message (Message.ToString()). The whitespaces seem to disappear between this stage and when the message is deserialized. My current workaround is an IDispatchMessageInspector with the following AfterReceiveRequest method: public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { // Doing this roundtrip over MessageBuffer removes the problem // (i.e. leading whitespaces are not removed) request = request.CreateBufferedCopy(int.MaxValue).CreateMessage(); return null; } Am I missing something he

How to: Verify That Strings Are in Valid E-Mail Format

This is HALF answered in the MSDN library with an example function called IsValidEmail. Does anyone else think maybe it's time the example function (which developers are likely to copy-paste) was changed to closer represented what an email address can actually be? Sure, it matches joe.blogs@example.com, or joe-blogs@example.com... But how about joe.blogs+work@example.com, or joe.blogs+support@example.com, or e=mc^2@example.com, or many other valid email addresses? The page http://msdn.microsoft.com/en-us/library/01escwtf.aspx has been updated for each new release of VisualStudio/.NET, but even the VS 2010/.NET4.0 one isn't much better!

Are these the same strings?

I just wanted to confirm. Let's say I have a method like this string GetValue() { string firstString = "Hello" ; return firstString; } Then somewhere else in the code I call this method. string secondString = GetValue(); My question is , are firstString and secondString the same string , or 2 different strings? I checked the memory addresses of both strings (using pointers) and they are the same, so my guess is that only one string is created but I want to be sure of that. thanks in advance.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend