URL issue in NopCommerce dot(.) is not accept in URL - asp.net

I'm working on NopCommerce Project and
I want a URL like : www.youstore.com/category.cfd
but in SEO I entered the category.cfd but it does not accept the dot(.) in URL it will automatically remove dot(.) while i'm saving the SEO name.
Please, help me out for that

Dots in this kind of urls are not supported by nopcommerce, all the urls of products and categories are cleaned to keep seo friendly urls.
You can tweak nopcommerce to allow dots (changing the source code or changing the UrlRecord table values) but when you add a dot to the url, the .Net extensionless handler used to process mvc request will not catch that request anymore, that means that you will recieve a 404 error because the web server will be searching for a phisycal file.
If the dot is mandatory by your requirements you can use the url rewrite module at iis level and rewrite all the urls (for example all the urls finished with .cfd) removing the dot, so internally you will have www.youstore.com/categorycfd or www.youstore.com/category, this can be tricky because you need to keep dots for file paths as images.

Related

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.

Upgrade Dnn 5 to Dnn7 now page names with dashes not matching static links

So I upgraded a very large DNN5 site to DNN7 for a client. Now all static links in the page content that point to page names with dashes are broken.
so the page name is Mid-Size Truck in the CMS
the static link from the old site that worked is www.somesite.com/MidSizeTruck.aspx
the upgraded dnn is now calling the link www.somesite.com/Mid-SizeTruck.aspx
so now when you click on the old static link it cant find the new page urls that have the dash included. There are thousands of these static links, is there a way to get DNN to remove the dashes like it use to?
I did however notice if the there is a space on both sides of the dash in the page name, dnn removes it from the url.
so ch1 - First Article
becomes
/ch1FirstArticle.aspx
Did you switch to the Advanced URL Provider (which is a web.config change)? Otherwise, I wouldn't expect the URLs to change.
There's a TabUrl table that has been introduced, which lets you specify URL aliases for pages (which will 301 redirect to the "real" URL). However, you may need to switch to the advanced URL provider to do that (which is theoretically unsafe since it might change URLs, but since it's mismatched, may not be any worse). To do that switch, find the <friendlyUrl /> element in the web.config, then change the urlFormat attribute to advanced for the DNNFriendlyUrl entry.
If DNNFriendlyUrl isn't the default friendly URL provider (e.g. you're using iFinity's 3rd party URL provider), that may be part of the issue, as well. At that point, you'd need to do some research with the developer of that URL provider.

Regexing it up with IIS re-write module

I am developing a profile-based web application where each user is assigned there own url through their username & iis rewrite mod's magic. A typical user's profile url would be http://www.mymark.com/mike
Each user is also created a blog in a multi-user wordpress installation. The wordpress url would look like this: http://www.mymark.com/blog/mike
I am trying to use the rewrite module to create more canonical urls for the user (http://www.mymark.com/mike/blog), and have tried several regex variations that I have created through RegExr(a regex generation tool) and come up with this as the pattern to match (www.|)mymark.com/([^/]+)/blog but haven't had any success so far. What am I doing wrong here?
Here is a screen shot of my re-write rule:
The entire host name (mymark.com) is not part of the URL, so you should not enter that as part of the Pattern. To make sure you easily figure it out, make sure to use Failed Request Tracing to extract the exact pattern that you should enter there:
http://learn.iis.net/page.aspx/467/using-failed-request-tracing-to-trace-rewrite-rules/
but its probably going to be something like:
(^/])*/blog

URL aliases: rewrite, routing, not sure

ASP.net 4.0 / IIS7.
I want to "alias" a single web form to appear as various extensionless urls. Given a form in my web root called "mySite.com/ColorWebForm456.aspx":
I want it served as multiple names, e.g., mySite.com/Color, mySite.com/Colour, mySite.com/Colors, mySite.com/Coler, etc., without creating folders and duplicate forms with those names.
I never want mySite.com/ColorWebForm456.aspx displayed in the browser, it needs to display as mySite.com/Color, even if the user somehow acquires it and types in that exact ~.aspx address.
The variations will account for several alternate or mis-spellings users might attempt - I don't want them "corrected", however. So, if a user types in mySite.com/Colour, the url is NOT rewritten to mySite.com/Color, but the same page is served via ColorWebForm456.aspx as the requested "mySite.com/Colour".
I've seen so many articles on this that I'm not even sure where this would be best handled: in Global.asax, IIS7 URL Rewrite, web.config, etc., and I'm not even sure this is technically a case of url rewriting or routing... ?
You can achieve this with ASP.NET 4 routing for web forms, or if you are using MVC its available too: http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx
Except potentially for #3; it would work, but you would have to explicitly declare the variations you want. In that case, rewriting supports regular expression matching, so that might be better for what you are looking for.
I had issues setting up URL rewriting and various aspects of web forms, so be aware. There is some setup required for a rewrite module potentially (I could have done it wrong too), where URL routing is already built in and handled.
HTH.
If you have a rewrite engine available:
(using ISAPI Rewrite .htaccess syntax)
# redirect any requests for the filename back to the friendly URL
RewriteRule ^/colorWebForm4567.aspx(.*) /Color$1 [NC,R=302]
# rewrite /Color requests to the web form
RewriteRule ^/(Color|Colour)/(.*) /ColorWebForm4567.aspx$2
Following article expalins it all, but if you will be using a web host after you complete your application I would check with the hosting provider first to see if they are offering everything you need to have:
http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/
Hope this helps!
As a side note: Search engines dislike it, if you publish content under different URLs ("duplicate content").
So my recommendation would be to stick with one (rewritten) URL, not multiple (rewritten) URLs for the same content.

How to get the URL the client used

In ASP.NET, how can I know whether the user has typed the default document in the URL or not—i.e., distinguish if the URL ends with / or /Default.aspx?
Nice problem :D unfortunately Request.URL.AbsoluteURI does not differentiate between the two in the default setup of IIS. IIS does a 'courtesy' redirect to the default pages existing in a web-directory, and this is done during protocol resolution -- i.e., ISAPI extensions do not see it (python framework , ASP.NET framework etc etc). You have two options :
Disable the courtesy redirect by unlisting default.aspx as default redirect, and then you will be able to use Request.URL.AbsoluteURI.
You will almost certainly not want to do this option.... Write an ISAPI filter to extract the data... perform a silent remapping (i.e., do not redirect to default.aspx, just remap the request headers') or when you redirect set a QueryString -- i.e., abc.com/default.aspx?redirected=1
p.s. this is what i get from three years of developing server plugins :/.

Resources