Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1702
  • Last Modified:

Escape String ASP.NET

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)
0
odonovanpm
Asked:
odonovanpm
  • 2
1 Solution
 
TimCotteeCommented:
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
0
 
SystemExpertCommented:
replase "\" with "\\"

thanks
0
 
odonovanpmAuthor Commented:
can you provide the code against my example... there should be a quote after href= and after 'ViewBrochure'
0
 
TimCotteeCommented:
odonovanpm,

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.

Tim
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now