ASP.NET website translation - asp.net

I want to translate my ASP.NET website, just like microsoft does.
I want the urls to have /en-EN/ or /de-DE/
the problem is that my urls ar already routed URLs
How can I do this?
I found this http://blog.maartenballiauw.be/post/2010/01/26/Translating-routes-(ASPNET-MVC-and-Webforms).aspx
but I don't want to translate all the urls and this method seems to me too complex, with Views and Controllers.
I need mysite.com/en-EN/routedpage or mysite.com/de-DE/routedpage

The above example is for mvc, is your website in mvc?. You need to setup your website for culture specific setting, here is an article how to do that
http://www.ezzylearning.com/tutorial.aspx?tid=3477182
Also for further reading
http://www.codeproject.com/Articles/7998/Creating-multilingual-websites-Part-1
and
http://www.codeproject.com/Articles/8073/Create-multilingual-web-pages-very-easily
its very easy to setup

This is an important problem. You want the URL to have the language encoded in it for both SEO and usability purposes.
Two common solutions are:
1) Change the domain. fr.example.com or de.example.com. Then the routes don't need to be changed.
2) Use the # for the language code. Search engines nowadays will observe this. So, then you'd have www.example.com/#de or www.example.com/#fr
You can implement both of these solutions with www.SiteTran.com by simply pasting our javascript into your page and setting the sitetran_url_type variable to either:
var sitetran_url_type = 'sub.domain';
or
var sitetran_url_type = 'hash';
SiteTran is 100% free and is my company.

Related

Convert query parameters to "pretty urls"

I have an Episerver site with a JobDetailsPageController with a Index method that takes a jobId parameter and creates a view with some details about that job. The urls looks something like this: https://hostname/<root-depending-on-site-tree>/jobs/?jobid=44.
What I would like is having urls on the form .../jobs/manager-position-telco-44, essentiallly creating a slug of the job title and appending the id. I have done this in the past using standard ASP.NET MVC Attribute Routing on a non-Episerver site, but EpiServer has a routing of its own that I don't know too well and can't figure out.
Also, adding non-query strings after the slash consistently sends me (no surprise) to a 404 page, so I would need to somehow customise this behaviour. I need to use EpiServers standard routing to end up at the right "parent", but ignore the latter part (the pretty bit).
Is it possible to create such urls on a normal page in page tree in EpiServer? I do understand it is possible to create static routes, but this node can be moved around like any other page so I cannot avoid EpiServer.
Please see this blog post. What you're looking for is partial routing.
#johan is right, partial routing is one way of doing this. Just wanted to add other possible solutions that might or might not match your needs.
Import data as content
Instead of serving content dynamically, you could consider importing your job ads from whatever source you have directly in content tree as separate pages below particular root page. That would give you a lot benefits - pages would be cached, it would support multiple languages, editors would see content directly in EPiServer CMS, data could be adjusted manually, etc.
This would be a good solution if your data does not change often and you need to provide a way for editor to create a new job ad manually as well.
Implement you own content provider
Another way to serve your dynamic data to EPiServer is to write your own custom content provider. You can find documentation here: http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/7/Content-Providers/Content-Providers/
This solution requires more coding and is more complex, but it has some benefits as well. If one wanted, it would be possible to not just serve content from external data source, but also update that data by changing values directly in EPiServer UI.

Best way for ASP.NET MVC5 localization where locale is passed in querystring with attribute routing

A very long title, sorry for that.
I'm looking for your input on the best way to support localization in an ASP.NET MVC 5 project in which i would like to pass the locale as part of the querystring. This way it would be easy for users to share a link to website and also pass the correct locale as part of the link.
If this would be done using, for example cookies, the user would pass a link but the page might be in a different language for the person who receives the link. I don't think that that is very nice.
The solution i currently use (http://afana.me/post/aspnet-mvc-internationalization.aspx) does not work nice with incorrect urls and just keeps loading the same page in loop. There is a lot of information on the web and i already went through a lot but i would like to know what is most commonly used and really works well.
As a bonus i would like the solution to work with attribute routing as my current solution doens't play nice :(
you can use resource files for that, the current culture is in the current thread of the web request, so no need to pass it in the querystring but it can be done;
have a look at this live demo: http://prodinner.aspnetawesome.com
you can download/read pdf about it here: http://prodinner.codeplex.com
you can see there that you can change the language using the dropdown;
in Global.asax.cs Application_BeginRequest, there's already code in there related to language, it reads a cookie now (or it's absence), you can make it read the querystring

ASP.net Web Form Routing

I want to use routing to create a multi-cultured web site.
I was thinking of re-writing the URLs for each language.
Contact Us Page - Example:
English:
http://www.domain.com/ContactUs
French:
http://www.domain.com/NousContacter
Instead of the traditional way of:
English:
http://www.domainname.com/en/contact
French:
http://www.domainname.com/fr/contact
Is this possible to do this without breaking search engines like Google and Yahoo?
I think these samples will help. Seems the first link is more close what I trying to tell.
Hope it helps.
http://geekswithblogs.net/shaunxu/archive/2010/05/06/localization-in-asp.net-mvc-ndash-3-days-investigation-1-day.aspx
http://msdn.microsoft.com/en-us/library/dd381609.aspx
https://gist.github.com/1583539

SEO dynamic / AJAX pages

I have a very dynamic / ajax powered website which also includes iframes and due this reason I have a very bad SEO rank and it come in my mind to make one more additional version of the site (text based / no script) and serve it to the search engines based on the user agent . Please let me know if you think that is a feasible method and if it's not what else would you recommend me to do .. I don't want to loose any fancy ajax feature but I also need to keep the website on the google map :)
thank you in advance for any answer !
btw the website is developed in asp.net c# .
Why not just refactor the site properly in the first place, instead of maintaining multiple copies? It's more effort up front, but will be less effort in the long-run.

Change page names or do a URL Rewrite?

I would like to change the page names of a ASP.NET site to make them more meaningful and more SEO friendly. My new page names with be more descriptive (ex: My_SEO_Friendly_Page_Name.aspx) My question is, is it enough to change the page names for SEO or do I have to implement the URL rewrite.
What are the differences of one over the other?
I think either method workds.
home/blog/this_is_my_entry_page_title.aspx
or
home/blog/this_is_my_entry_page_title
You mainly want to do URL rewriting to avoid using query string parameters. So instead of:
home/products.aspx?qid=25
You would want to use:
home/products/Cell_Phone
Instead of My_SEO_Friendly_Page_Name.aspx use My-SEO-Friendly-Page-Name.aspx for better SEO.
Search engines consider _ (underscore) to be a character and (-) minus sign to be a word-break. More words - more keyword matches.
the result for SEO is the same, it's the implementation that's different.
when you implement url rewrite, any request to http://domain.com/My_SEO_Friendly_Page_Name.aspx will be served with e.g. http://domain.com/index.aspx?id=12 where the 12 refer to the page id in the database, and the page in question has the title 'My SEO Friendly Page Name'
so, this approach is more suitable to implement on large sites which store it's content in a database.
The search engines cannot tell the difference. So one method is not better than the other as far as SEO is concerned. If you implement Url Rewriting, IIS hides the fact My_SEO_Friendly_Page_Name.aspx actually gets mapped to Default.apx?id=1234. To the outside world, it is the same as a page named SEO_Friendly_Page_Name.aspx
If you can use .net 3.5 sp1, don't use rewrite. Use routing.
Routing with ASP.NET Web Forms
One issue you may have is if the existing pages are already indexed by the search engines, if you throw up a whole load of more pages which are in fact just the same then you have a lot of dupe content on your site. To avoid the dupe content a sitemap may help to some degree, you can instruct google to delete pages, or to ignore certain url parameters, which would then delete your old pages that use a url param, or you can get your app to http 301 the old pages to the new one.
You should use 301 redirects, if possible. You can do this in a .htaccess file, however for a large dynamic site it's probably better to use ASP to handle it.
So if you original page was index.aspx?page=52 then your index.aspx script would look up the ID of 52 in your database, find the appropriate "slug" or "alias", say My_SEO_Friendly_Page_Name and set the headers etc in ASP to redirect to that URL.

Resources