Adding " target=_blank" to a String.Format ASP.NET

Hi,

I need to add " target=_blank" to the below code to make the link open in a new page.
Any idea how to add it?

Thank you!!!



 private static readonly string link = "<a href=\"{0}{1}\">{2}</a>";

 if (!match.Value.Contains("://"))
                {
                    body = body.Replace(match.Value, string.Format(link, "http://", match.Value, ShortenUrl(match.Value, 500)));
                }
                else
                {
                    body = body.Replace(match.Value, string.Format(link, string.Empty, match.Value, ShortenUrl(match.Value, 500)));
                }

Open in new window

Rad1Asked:
Who is Participating?
 
Miguel OzConnect With a Mentor Software EngineerCommented:
change:
private static readonly string link = "<a href=\"{0}{1}\">{2}</a>";
to
private static readonly string link = "<a href=\"{0}{1}\" target="_blank">{2}</a>";

further info check:
http://www.w3schools.com/TAgs/att_a_target.asp
0
 
Rad1Author Commented:
Excellent!!!!

Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.