Upgrade Dnn 5 to Dnn7 now page names with dashes not matching static links - asp.net

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.

Related

ASP.NET web forms, relative paths broken by multilingual Urls

I recently was asked to transfer a multilingual site from working with languages based on cookies, to removing the cookie containing the language in the URL, for better SEO, while keeping the default language without the "prefix".
So instead of "mysite.com/page", I would have "mysite.com/{language}/page" for every language except for the default.
And so I updated the routing in the project to include the "{language}/URL" in an additional MapPageRoute for each URL.
The issue now is with relative paths for scripts and images etc.
When I am not in default language, the URL of these requests contains an additional "/en" or "/fr" or something, and of course there is no such folder.
Is there any workaround for this? I really don't want to have to replace close to thousand paths with absolute, or check for language before declaring them.

How to check for a (date?) variable in a url before allowing access to site

Building a site (in Drupal) that can only be linked to and viewed by members of a separate site (asp).
The URL to the Drupal site will only be visible to members on the asp site but I don't want them to copy and paste that URL and share it with non-members.
So... how do I make that URL constantly changing and distinct (i.e. current date?) and how do I have the Drupal site check to see that the URL is coming from the member site only?
I was thinking an .htaccess file could check for certain variables in the URL.. but A) don't know how to add a changeable variable to the URL and B) don't know the mod rewirte rule to check for that variable in the URL
Any help appreciated....
Not sure how efficient a deterrent it would be.. but time will return the current date which you can then append to your url.
Most web browsers pass the HTTP_REFERER variable by default, but in many this behaviour can be changed to not show it or to pass something else instead. There is also 3rd party anti-spyware etc software that can be installed on a user's computer which also prevents the referrer information from being passed to the web server. Because it can also be changed to something else, the HTTP_REFERER cannot be trusted, but it is still useful for working out where people have come from.
Copied from electrictoolbox.com read more here

Plone, behaviour of URLs

The situation is the following: I created a site with Plone, developed, used, but behind a test URL. Now it has to be published, but the test URL is not appropriate and I don't want to move the site. I think, if I use a redirect, it won't be appear in the URL-bar, only in the case of site start page. Am I wrong? (The test URL should not be used, because it will be a "semi-official" site.) What do you suggest to do?
As far as I can see Plone uses absolute URLs everywhere. I can add relative URLs, but if I create a new page, a new event, etc., then they have absolute URLs on other automatically generated inner pages. Is there any way to convert these URLs to relative paths? Is there any setting possibilty where only a checkbox changes this default setting?
Plone does not store your URLs in the database. It uses the inbound host header (and any virtual hosting configuration set up with rewrite rules in Apache or Nginx) to calculate the correct absolute URL when rendering the page.
In other words - as soon as you actually point the relevant domain name to the server with your Plone instance, it'll just work.
P.S.
You should put a bit more effort into asking your question. This is just a copy and paste of a half-finished email chain where you tried to get the answer from me in private. It's not very easy to understand what you're asking.
I think what you are looking for is url rewriting to handle virtual hosting. ie to get your site to appear as if it's the root url of a domain.
This is normally done via the webserver that normally sits in front of plone. For apache, here is a howto
http://plone.org/documentation/kb/plone-apache/virtualhost
for other servers
http://plone.org/documentation/manual/plone-community-developer-documentation/hosting
You can also achieve this directly in zope (via ZMI) using something called the Virtual Host
Monster. see http://docs.zope.org/zope2/zope2book/VirtualHosting.html
PS. I don't think your question is badly worded. Plone does serve pages with a "base" tag and what appears to be absolute urls. They aren't baked into the database but it's also not obvious that the solution to getting the url you want is the VHM url syntax and a proxying frontend webserver. There is a reason why it doesn't use relative urls... which I can't remember it was so long ago.

Master Page compilation and Absolute URLs

UPDATED 03/04/09
In response to some comments, a sample from the master page looks like this. This is not an asp.net control, this is hard coded html
<span class="topleft"><span class="bottomleft">About us</span></span>
This renders on the production server as
<span class="topleft"><span class="bottomleft">About us</span></span>
MYDOMAIN is the true domain name of our main site, NEWDOMAIN is a perfectly valid DNS entry which points to the same site.
UPDATED 02/04/09
All the URLS are absolute in the sense that they begin http://
I don't think this can be a browser issue as the actual rendered source code (viewed via view source) has been changed. Checked in both IE7/8 and Firefox 3 and witnessed same behaviour.
Original Question
I have an ASP.Net 2.0 application which has several master pages. This is essentially mocked up to look exactly like our main website, but because it runs on a different server all of the URLs for menu items etc are given absolute URLs to our main site.
This works fine on my development machine, but on the production server all of the URLs which are absolute are changing at runtime, but they still end up at the same pages when clicked.
Is this a DNS issue? Does ASP.Net do some DNS resoltion of URL's when the master page and content are merged? If so then why does it not have the same effect on my local machine, they are on the same domain.
No, it's not a DNS issue, and ASP.net doesn't do any DNS resolution. That's all the responsibility of the browser you're viewing the page in.
However, there are several circumstances that can lead to inconsistent URLs being served in the page's mark-up, which may be interpreted differently by the client's browser.
Browser's will always interpret a URL beginning "http://" the same way - it's an absolute URL, so the destination will always resolve to the same thing. Make sure all your URLs to your main site begin "http://".
URLs beginning "www." (no http://) will be treated as relative URLs - i.e. if the page containing the URL is at http://www.google.com, you're essentially asking for http://www.google.com/YourUrl. You'll find this almost certainly isn't the behaviour you're looking for.
URLs beginning with a leading slash (/) will be treated as absolute on the current domain. For example "/Tools", within Google will result in a request to "http://www.google.com/Tools". If there's no leading slash, the browser will treated the URL as being relative to the page currently being viewed (i.e. a URL of "Tools" when you're viewing a page in the "en" folder would result in a request to "en/Tools".
I think this is where your problems are arising. For consistent behaviour, I find it's a good rule of thumb to ensure all URLs begin with a leading slash. If you want to ensure all your hyperlinks generated by your ASP code are correct, use the tilde (which ASP will replace with the path to the application root folder):
<asp:Hyperlink id="Test1" runat="server" NavigateUrl="~/Tools/Default.aspx">Tools</asp:Hyperlink>
This way, it doesn't matter where your page is in your site structure, whether you're using Cassini, a web site in IIS or a virtual directory in IIS - the URL will always resolve to the correct address.
If you want to output a URL that isn't a property of a server control, use the ResolveUrl method:
Tools
Hope this helps.
By "absolute" I assume you mean they start with a "/" rather than a folder name?
If you are using the ASP.NET hyperlink control, then these will tend to modified to start at the application root.
Edit for comment
Can you give us an example of how the urls are being changed? i.e. From http://www.example.com/somepage.aspx to http://www.example.com/trackingpage.aspx?somequerysting - or is the domain changing? or something else?
You say "they still end up at the same pages" - so clearly things are working. Have you got any HttpHandlers registered in the web.config on your production servers that could be modifying the URLs for you so that they all go through some logging system? I.e. taking the response from the server, processing the resultant HTML, modifying all links - does it happen with simple anchor tags as well as Hyperlink controls?
Are you using a custom base page that is performing additional steps in PreRender or Render that's different on production to your developer machine that is changing the URLs?

Where content based websites store their content?

Sites like cnn.com or foxnews.com.
Where do they store all the articles? In html files? In database?
More logically to store everything in DB but how to generate a static link to something that is inside DB?
It's not that they have a a dynamic page load like: LoadArticle.aspx?ArticleID=123, every article has it's own address.
Please explain how this is done.
They use a special content management library called VoodooLib.dll.
Seriously, when you write something to a database, you normally generate some kind of unique identifier - 123, for example. It gets permanently associated with that record (article content). After that it is used to generate the same id as part of an Url at any time later.
As for the static link, it is a simple matter of Url Rewriting.
You generate static links to display on a page because they work much better for SEO. When a request for that static Url hits the server, it gets substituted for something "server friendly" and then gets to be processed.
They probably use some form of Content Management System (CMS). There are many different ones out there - most store the actual content in a database or as XML (some store XML in a database). They will the either publish that content as static HTML pages or, more commonly now, as dynamic pages that are cached. Many use what are known as "friendly URLs" that are virtual addresses that are mapped to the actual physical file path using URL-rewriting techniques.
Note you can't tell whether a page is dynamic or static simply from the extension. It is quite possible to have dynamic pages that end in the .html extension.
Just because the URL looks "static" doesn't mean it is; they could be using something like mod_rewrite or an IIS ISAPI to make the URLs more search engine friendly.
For the high-volume news sites that you mention, however, they may very well generate the pages statically in order to prevent overloading the database with repeated requests for the same article.
Look at the URl of this page, it doesn't have xxx.aspx?some-query-string
You are refering to using friendly URLs.
To do something like that, one common way is to use URL Rewrite and/or some custom HTTPModule
Here's a good reference: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
Just because a page has a normal URL does not mean that it isn't serving dynamic content. With the Apache mod_rewrite module, it is possible to manipulate URLs. So, for example, a page like http://www.domain.tld/permalink/12345/message-title-slug can be converted internally to http://www.domain.tld/permalink/index.php?id=12345&slug=message-title-slug.
I do not know exactly what cnn.com and foxnews.com use, but I would bet that they use a Content Management System (CMS) which serves all pages dynamically, with the content stored either in a database or on the filesystem, and with authoring/publishing all being performed through the particular CMS.
Just checking cnn.com, the article links have in them
Year
Location (US or WORLD/specificlocationid)
Month
Day
Article name.
All of this information together can be used to uniquely identify any article (even less of it is probably actually needed). The dynamic content loading page address could easily be hidden by some method of URL rewriting, and then the information in the requested URL is used to determine which article in the DB is to be served up.
I don't know why all the other answerers seem to assume that some form of URL rewriting is necessary to create friendly URLs. It's not true at all.
It's perfectly possible to write web serving code that splits a URL into parameters - eg year, month, title - and pass that directly to the code that gets the content from the database, without any need to rewrite the URL. Most modern web frameworks such as Django and Rails include this functionality out of the box.
This is done through mod-rewrite techniques.
Here's an article about the mod rewriting engine: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
And here's their "guide": http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
I hope that helps. It should make for a good starting point. Goodluck.

Resources