Url must use the following format <a class="postlink" href="http://www.domain.com/my-url-slug-here">www.domain.com/my-url-slug-here</a> .I have created the database and all data in the application structor. But in Web MVC I do not know how to implement.
3 Answer(s)
-
0
Hi,
This is actually a general topic related to ASP.NET MVC. So, I suggest you to search it in the web for a better answer. I generally do it like <a class="postlink" href="http://www.domain.com/p/my-url-slug-here">www.domain.com/p/my-url-slug-here</a> (with a PController) and defining a special route like p/{pageName} and pass this pageName to the PController and return the related page. But as I said, you can probably find exact answers on stackoverflow by searching it. If you can not find, I also search for it.
-
0
I can create with a <a class="postlink" href="http://www.mydomain.com/br/url-to-Brazil">www.mydomain.com/br/url-to-Brazil</a> and <a class="postlink" href="http://www.mydomain.com/en/url-USA">www.mydomain.com/en/url-USA</a> for multi language? to have the same content in different languages?
-
0
Yes, you can do it with proper ASP.NET MVC routing configuration. When I seach for "asp.net mvc language based route", the first result explains a similar case: <a class="postlink" href="http://stackoverflow.com/questions/1712167/asp-net-mvc-localization-route">http://stackoverflow.com/questions/1712 ... tion-route</a>
One additional thing is that: You should set Thread.CurrentCulture and CurrentUICulture to the selected culture. You can do it by overriding Application_BeginRequest in global.asax <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.Web/Web/AbpWebApplication.cs#L67">https://github.com/aspnetboilerplate/as ... ion.cs#L67</a>
In this method, just check culture code in URL and set Thread.CurrentCulture and CurrentUICulture to the selected culture. If you can not find it in URL, just call the base.Application_BeginRequest