I am using facebook api for posting to the facebook wall post.THe post is getting displayed in the wall but i am not able to show the link which redirects to the site when it is clicked. I need to show both the post as well as the link which points the posted post. Following is my code
string viewDetailsLink = context.Url.GetLeftPart(UriPartial.Authority).ToString();
viewDetailsLink = viewDetailsLink + "/" + "Blog" + "/Index/" + "0/" + blogPost.Id;
viewDetailsLink = "<a href='" + viewDetailsLink + "'/>" + "click here to open" +"</a>";
But the whole thing is displayed as string instead of click here to open
.
How do i resolve this?
You're seeing text instead of a link because you're closing our anchor tag prematurely. Try this instead:
viewDetailsLink = "<a href='" + viewDetailsLink + "'>click here to open</a>";
Here is the issue with your code:
viewDetailsLink = "<a href='" + viewDetailsLink + "'/>" + "click here to open" +"</a>";
Shouldn't close tag here ^ ^ No need to concat ^
Your code, fixed and prettied up a bit:
string viewDetailsLink = context.Url.GetLeftPart(UriPartial.Authority).ToString();
viewDetailsLink = String.Format("{0}/Blog/Index/0/{1}", viewDetailsLink, blogPost.Id);
viewDetailsLink = String.Format("<a href='{0}'>click here to open</a>", viewDetailsLink);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.