I currently have an .net Mvc web project that displays comments that are submitted by users and are stored in a database.
I was wondering if anyone had any information on how to embed a link in the comment so that is can be clicked on and followed to the desired well link :)
I am aware that I can google this however with the language in this given question finding an answer on google has been quite basic and not too accurate.
Well you can store the comments as html in the database then display it using Html.Raw but that opens up many security flaws. The best option is to setup some custom tag to represent a link such as [url link="example.com]click here[/url] and then using a razor helper parse that and transform it into a html link.
Related
It is necessary for me to fetch user comments in each news page in CNN website, which uses disqus comment system. I have used c# for html parsing. Is there any specific code which I can use in order to extract the commented author and the comment using c#.
Thanks in advance,
Dinusha
Since the Disqus embed is a javascript embed, the comments won't be available in the page source unless the site renders them there. If you're scraping the page and letting the javascript render, then the first page (up to 50 comments) are available within the Disqus iFrame within the "postCompatContainer" DIV.
However, I'd instead suggest using the Disqus API to accomplish this. There's two main parts to this:
Get the thread information from the article
Specifically in the page source you have to find the variables 'disqus_shortname' and 'disqus_identifier' or 'disqus_url'. If 'disqus_identifier' or 'disqus_url' aren't available, then you can try using the window location address, but this is less reliable.
Make the API call with that data.
Specifically you'll want to use our threads/listPosts endpoint passing the 'disqus_shortname' as the 'forum' and the identifier or url as 'thread=ident:' or 'thread=link:', respectively.
I won't go into the specifics of using the API here, but we have a good starter tutorial here: http://help.disqus.com/customer/portal/articles/1131783-tutorial-get-comment-counts-with-the-api
and more examples here: https://github.com/disqus/DISQUS-API-Recipes
I'm absolutely new in ASP.NET.
I've got a web site running under umbraco cms (ASP.NET). I need to create a simple wizard: step by step user will answer questions using simple controls (checkboxes, dropdown lists, radiobuttons, textboxes, etc.). Some steps depends on previous answers, some of them doesn't.
So, I've got 2 questions on this:
What is the best practice to create wizard on ASP.NET web site? I looked at System.Web.UI.WebControls.Wizard class here but I'm not sure it's a good approach to mix asp.net controls and html markup together, especially paying attention to the fact, that every step of the wizard is described in one huge markup file.
I've got the samples of html markup of wizard steps (static aspx pages). That's why I want to divide html and logic. I want to be able to apply new design and markup in the future, not changing code. What is the best approach for this - dividing html and c# code?
Examples are welcome.
Thanks in advance.
im starting the pseudo code of a new site, and want it to be as SEO friendly as possible.
the site i am creating is a booking agency site with c# and asp.net. essentially bands will register on the site with their availability and other info, and fill out their profile information with images etc. this info will be stored in a db.
creating this is not a problem, but i want the site to be a SEO friendly as possible.
I know google loves huge sites with great content. And all of these profile pages would be an excellent addition to my site for seo purposes. i also hear that google cannot see dynamically generated content when crawling a site.
i want to find a method of coding these pages, so google can see the content when it crawls them.
i need a pointer in the right direction for a solution for this. nothing is off limits - i will basically code my entire site around this principle, i just have no idea where to start looking for a solution. im not looking for a code solution, just what i should be researching to solve this issue.
Thanks in advance
i also hear that google cannot see dynamically generated content when crawling a site.
Google can see anything you can retrieve via http GET request (ie: there's a specific URL for it) and that someone either linked to or is listed in a published xml site map file.
To make sure that your profile pages fit this, you will want to make sure that profiles are all rendered via a single asp.net *.aspx file that determines which page is shown via a url parameter. Something that looks like this:
http://example.com/profiles.aspx?profile=SomeBandName
Now, you probably also want a friendly URL, that looks like this:
http://example.com/profiles/SomeBandName
To do that, you need to set up routing.
In order to crawl and index your pages by google or other search engine properly. Follow the following guidelines.
i: Page title must be precise and according to content available in page.
ii: Page url should be user friendly.
iii: Content is king (useful content)
iv: No ajax or javascript oriented way to load contents.
v: No flash or other media files. if exist must have description via alt tag.
vi: Create url sitemap of all static and dynamically generated contents.
vii: Submit sitemap to google and keep tracking how google crawl and index your pages.
fix issues contineously if google found via crawling.
In this way your most pages and content will be index properly and fastly.
I'd look into dynamic URL Rewriting.
Basically instead of having one page say http://localhost/Profile.aspx you'll have a bunch of simulated urls like
http://localhost/profiles/Band1
http://localhost/profiles/Band2
http://localhost/profiles/Band3
etc.
All of those will then map to back to the orgial profile.aspx page with a parameter so internally in your code it would look like http://localhost/Profile.aspx?Name=Band1, http://localhost/Profile.aspx?Name=Band2, etc
Basically your website appears to have a bunch of pages for each band but in reality they are all getting mapped back to the same asp.net page but have different parameters.
This is article I read about it some time back. http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
i also hear that google cannot see dynamically generated content when crawling a site.
you could create a sitemap.xml with the urls pointing to the dynamic profile pages. using google webmaster tools you can submit and monitor the crawling progress.
you may also create an index page or something similar ('browse by category' pages) that link to matching profile pages.
a reference for seo I regularly use is http://www.seomoz.org/learn-seo
I wish to use Google organisational chart within my ASP.NET MVC project. I am however finding it difficult to get my head around how this would fit into the MVC architecture.
The Javascript to generate the chart will be contained in the head of my file and as this data will reguarly change, it needs to dynamically be created. Can anyone give me any tips on where to begin with this?
take a look at this page. Scott Gu talks about Sections in MVC 3. I've used this before to create a section in the head tag to place script block/styles that apply to only one page, this gives you the freedom to use page specific script/styles without make your DOM a jumbled mess.
How can i create a simple aspx page with a dropdown have two enteries
1. Translate to greek
2. Translae to english
I'll be getting the data from a db table which is in English. While choosing the items from the dropdown the text should change accordingly. How an I achieve this ?
code snippets would be helpful
If you are storing only the English version of your site in the database you will need some language translation API. Google provides such service: it's called the Google AJAX Language API and allows you to translate text between different languages. Here's a sample in C# of how it could be used.
Take a look at Microsoft's Translator Widget
It does what you want (if I've read your post correctly and understand what you're after) pretty easily!