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

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

Apostrophe bug!

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
I when i fill out my form and submit it, the results just dissapear into the blue. From reading around i can see that its a bug when people use the Apostrophy within the forms. Iv trying to exchange one ´ for two ´´ which should help, for a weird reason it doesnt work. I get this error when i try to run the pageCS1056: Unexpected character '"'here is my code protected void submitBtn_Click(object sender, EventArgs e) { Request.Form("RsoCommentTxtBox").tostring.replace("'", "'");

View Complete Post

More Related Resource Links

UrlEncode does not appear to be encoding apostrophe's

All,I have spent quite a bit of time researching this here on Asp.Net's Forums, but also on the web in general, and I am still drawing a blank.The problem:  I am trying pass a values such as ... "Jacob's Carpentry" as a query string to another page.  However, the other pages keeps seeing "Jacob\\s Carpentry".What I have tried:  I have tried using both the Server.UrlEncode and HttpUtility.UrlEncode, and neither have worked.  I have also tried using them twice as was suggested in this article, but still with no luck.  Finally, I went so far as to try and encode the string, but then do a String.Replace on the " ' " apostrophe and substitute with a "%27".  This also did not work, as it appeared that the String.Replace wiped out the encoding.So I am stuck/lost.  It appears the standard PHP functions easily encode the apostrophe, but for some reason the .Net function isn't working.Here is the code I am using ..._postAReviewLinkButton.PostBackUrl = "~/ReviewskiPostReview.aspx?company=" + Server.UrlEncode(theCompany.CompanyName);As I understand it, when using the Request.QueryString method, it will automatically Decode the value as well, so when I read it, I am simply doing the following ...Company.GetByCompanyName(Request.QueryString["company"].ToString());I notice,

Unable to enter apostrophe ( ' ) in the textbox (Asp.net C#)

Hi friends , Im unable to enter apostrophe(') in the textbox as got error message as per below . How to solve this ? Pls help .thanks     Server Error in '/' Application. ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.1.46-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Agriculture, forestry and fishing(cultivation of land or animals).',''','Mr','',' at line 1 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.Odbc.OdbcException: ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.1.46-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Agriculture, forestry and fishing(cultivation of land or animals).',''','Mr','',' at line 1Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [OdbcException (0x80131937): ERROR [42000] [MySQL][OD

Problems escaping apostrophe when using an XPath query with SelectSingleNode

I have an XML node which I am trying to search for a specific node which has a given value, but I am having problems when the value contains an apostrophe. I have tried replacing the apostrophe with &apos as follows:                string encodedTitle = title.Replace("'", "'");                 string XmlPath = String.Format("item[title = \'{0}\']", encodedTitle);                 return NodeChannel.SelectSingleNode(XmlPath);                string encodedSearchString = searchString.Replace("'", "'");                string XmlPath = String.Format("item[title = \'{0}\']", encodedSearchString);                return myNode.SelectSingleNode(XmlPath);However, this does not seem to find search strings with an apostrophe (it doesn't throw an exception or anything, it just returns null). Search strings without an apostrophe work fine. Is there any way I can fix this?

Custom Search WebPart issue with apostrophe


I have a custom search webpart which returns the results based on the search input from a text box. The search is performed on a managed property called "CustomerName". When the customer name has apostrophe " ' " in its text, the search results are not returned because of the wrong query formation. 

I need to use a escape sequence and pass the search query. Can anyone help me how to form the query for this ?

Example: Customer name : A'BCD

SQL & JavaScript - Apostrophe Issue, SELECT statement is not returning any results.



Any help would be great on this.

I have the following code within an .asp page in JavaScript:

function SDsitecalls1(Sitename)

end function

The function is called via the below:

 <td style="width: 114px" class="style65"><a href="/suppdesk/customercalls.asp?customer=BSFMAN&site=Our+Lady''s+R+C+Sports+College"><%=SDsitecalls1("Our Lady's R C Sports College - Hbev")%></a></td> 

When this is ran I do not receive any errors but the SELECT command doesn't return any results (Just a 0). I've tried a few different methods such as using the Parameter SiteName and Single/Double Apostrophes however I either receive an error or blank results.

The function works with all other names however the apostrophe seems to cause issues here. Is there a way to extract the data without editing the SQL?

Thanks very much for the help,


String.equals() and apostrophe


I just ran into what I consider a very strange issue in the execution of some code that I thought I had completely well-understood. Basically, I was using this kind of notation:

If strOne.equals(strTwo) Then

rather than

If strOne = strTwo Then

I came from a c and java background, and using the '=' operator for comparison has always made me cringe, so I've used the .equals() comparison function thinking that it was equivalent.

But just now some of my code broke. It encountered a string containing "Eagle's Nest: Dawn Patrol", used the .equals() to compare it to "Eagle's Nest: Dawn Patrol" and declared them not equal. I changed the code to use '=' rather than '.equals()' and it declared them equal. I also did this:

If strOne.Replace("'", "").Equals(strTwo.Replace("'", "")) Then

and again, it declared them equal.

This has me a little rattled because my code is filled with the use of .equals(), and I've used it assuming that it was no different than writing strOne = strTwo. I've scanned the interweb looking for information about this. I have not found any information about odd interactions between the apostrophe (or other) character(s) and .equals(). Microsoft's documentation does not hint at any subtle differe

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