Escape String ASP.NET

Posted on 2006-04-25
Last Modified: 2010-08-05
I am returning a hyperlink to the code but I need to place a section of it within qutoes " " - I usually use songle qutoes within double quotes but what do I do if I need to go one level deeper... In php there is an escape charachter (backslash \) when you want to use quotes in this manner.

Return String.Format(" | <a href=javascript:MM_OpenBrWindow('{0}', 'Printable', 'width=460,height=600,top=0,left=0') class='ViewBrochure'>Printable</a>", mURL & "/printable.aspx?propid=" & ID)
Question by:odonovanpm
    LVL 44

    Expert Comment

    Hi odonovanpm,

    Use "" instead:

    For example: Mystring = "Something + 'something else' + 'something "" even deeper ""' + 'and that is it'"

    Gives you Something + 'something else' + 'something " even deeper " + 'and that is it'

    As a result.

    Tim Cottee
    LVL 10

    Expert Comment

    replase "\" with "\\"


    Author Comment

    can you provide the code against my example... there should be a quote after href= and after 'ViewBrochure'
    LVL 44

    Accepted Solution


    Return String.Format(" | <a href=""javascript:MM_OpenBrWindow('{0}', 'Printable', 'width=460,height=600,top=0,left=0') class='ViewBrochure'"">Printable</a>", mURL & "/printable.aspx?propid=" & ID)

    Would do it. This will embed single " in the result.


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now