1

I need to convert the a link from the database to url. For far I am not able to convert it properly because there is some characters like \ appearing the link that I am retrieving from database. How can I properly convert it?

This how my link looks when getting from code.

"\"/Reading/04082017042819PM.jpg\""

This how the entire url looks like.

"http://mypc.rocketserver.com/\"/Reading/04082017042819PM.jpg\"

This how I'm converting it.

 string imagelink = mmr.Imagelink;

 string link = String.Format("<a href=\"http://mypc.rocketserver.com/"+imagelink+"\" >View Image</a>");

This how the link string looks like.

"<a href=\"http://mypc.rockertserver.com/\"/Reading/04082017042819PM.jpg\"\" >View Image</a>"

1 Answer 1

4

When you get the image link from the dB remove the escaped double quotes:

string imagelink = imagelink.Replace("\"", string.Empty);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.