changing page address format - asp.net

I create a website with ASP.NET web form and I used URL friendly to shape my URLs , by URL friendly my URLs change but not enough for example one of my page "تور استانبول" URL after changing by URL friendly is Domain.com/tours/تور-استانبول/استانبول/1 but I want Domain.com/تور-استانبول/استانبول/
please note that I don't want to query on sql to rewrite to my page and also I don't want to create static page and because my pages are dynamic I can't write all of them in web config file
please help me in this case

Hamid, you can use asp.net routing. The following link contains explains how to do it:
https://msdn.microsoft.com/en-us/library/cc668201(v=vs.100).aspx
hope it helps

Related

How to create sub domain in asp.net

I have a website with the name of technotecode and address is http://www.technotecode.in.
In my site around 176 people are registered, when user open his profile page URL Look like this
www.technotecode.in/user/username.aspx
Instead of above URL I want to modify URL like this
username.technotecode.in
Any one suggest me how to achieve this
You can try below url here its explain some basics about URL rewrite using controller
How to create subdomain with username using C# and asp.net?

web.config image to web page redirect in .Net?

Is there a web.config code I can use to redirect the url of an image to an actual web page?
What can I do to make it so when someone access an image via their address bar by typing in: http://www.sitename.com/images/1.jpg
It will instead redirect the user to the web page: http://www.sitename.com/view/1.html
I want to still be able to place the images in image tags though.
Create Rewrite Rules as explained here. You can do it on the IIS manager.
You will only need a regular expression for detecting the matching URL strings and an action which in your case is a Rewrite.

ASP.NET Web Forms URL Rewriting capability

I have a very simple question, rather I am just curious.
I have about 2000 pages of the url format somewebsite.com/ShowProduct.aspx?ID=223 . This particular url has a page title as 'Walking sticks for elders made from durable steel'.
Can I use URL Rewriting to convert this to a url like somewebsite.com/walking-stick-for-elders ? Also will I have do it dynamically for 2000 pages or is there any expression that can be used?
You need to have some thing which uniquely indentifies URLs just like Stackoverflow does it.
ASP.NET Web Forms URL Rewriting capability
See this question URL - Where from URL you get its for question then there is a question id and then description. I suggest you do the same.
If you are using ASP.NET 4.0 or higher version then you can do that type of URL routing very easily.
Like from this URL - http://weblogs.asp.net/scottgu/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series
There is also a asp.net friendly URL package form where you can write URls.
http://www.hanselman.com/blog/IntroducingASPNETFriendlyUrlsCleanerURLsEasierRoutingAndMobileViewsForASPNETWebForms.aspx
RouteConfig.RegisterRoutes(RouteTable.Routes);
If each product name is unique and stored inside the database you can easily route each SEO friendly URL to productID without manually inputing a new route in the Routing table.

how to show dynamic html page instead of aspx page with query string variables

we are using framework 3.5 please let me know how can I achieve following
instead of showing
http://www.mydomain.com/microsite/index.aspx?projid=3&adid=5
I want to show something like
http://www.mydomain.com/[cityname]/[keyword]/[customer-project-name]/index.html
where [cityname],[keyword],[customer-project-name] will be dynamic based on projid, adid
we want to do this for SEO
Use Urlrewritting to make your pages more Url / user friendly.
Please consider reading below mentioned articles and that may be helpful to you.
http://msdn.microsoft.com/en-us/library/cc668201.aspx
How to SEO friendly an existing ASP .NET 3.5 web application under IIS6
You could create a HttpModule which rewrite the url or use a existing Url Rewriting Module like UrlRewriter.net . Here is a blog post about this subject.

Replace the url without refreshing the page in .net

My default url home page is http://www.brindesbb.com/Pages/Default.aspx.
but I dont want to show Pages/Default.aspx in the address bar.
can anyone suggest me how to replace the url without reloading (refreshing ) the page.
Thanks in advance
You can do so in two ways IIS URL Rewriting and ASP.NET Routing
http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/
What you want to do is URL Rewriting, read more here URL Rewriting in ASP.NET
Update: If you setup a new website(or edit the one you have) and point the /Pages directory as "root" and aspx is an default document the url will be as you want.
Technically that not possible with .net as .net is used on server side. and you need to change the URL which is on client side so... you will need to use JavaScript to manipulate the Browser URL history. Example [asp.net mvc] my url is http://localhost:123/Home/Product and I need to change it to http://localhost:123/Home/Product/301 this can be achieved by
<script>
window.history.pushState('', 'My Page', 'Home/Product/301');
</script>

Resources