Orchard CMS - menu link to network-shared file - orchardcms

I have an Orchard 1.6 site hosted on Windows Server 2012, IIS 8.5, .NET 4.0.
I need to add a link to a network-hosted file into my Orchard menus, where the network share is accessible from my web server - the destination file itself resides on a different server. I put in file://path/to/network/file in the Custom Link menu URL, but the base URL of the site always gets prepended to the link.
E.g., if my base URL is http://example.com, the link becomes http://example.com/file://path/to/network/file, and then .NET does not like the second : in the path - on top of it being the incorrect link. No combination of forward-slashes, backslashes, or other symbols prevents the prepended base URL.
To add another wrinkle to this, the same URL scheme works fine with a slightly different setup: Orchard 1.6, Windows Server 2008, IIS 7.0, .NET 4.0; web server and destination network URL are on the same server.
Is there a way to force Orchard to use the URL as given, without changing it at all? Alternatively, where is the code that constructs the final link?
Using a 'HTML menu item' instead of 'Custom link' to insert raw HTML as a link does work, but that seems like a pretty kludgy workaround; I have to do this for a few dozen links, and I won't necessarily be the one to change them later on.
I've looked into Orchard settings and IIS settings; neither has anything about rewriting links. Changing the base URL on Orchard to match the expected destination server doesn't work (and wouldn't be acceptable long-term). I've also tried hosting a temporary local file (c:\temp\test.txt) but I can't even get that to produce the correct file:// destination on the new setup.
Upgrading to the latest Orchard (1.8.x) is not a feasible solution (if that even ends up being a possible solution).
Edit:
I should clarify that both sites are on an intranet; I'm aware of the security implications associated with file:// links, and the problems with getting various browsers to load them properly, but I want to get the link generation working first.
Edit: problem source
I figured out why link handling was inconsistent between my own sites - I had written a small chunk of Javascript in the first site to strip the application's base URL for any file:// links it encountered. I forgot that it was there and hardcoded to remove only a certain base URL, so when I moved the site to a different hostname, it broke.
So, no inconsistency in Orchard, just my own faulty memory.

Orchard deliberately limits menu links to mailto, tel, http, and https protocols, and excludes all others, such as file and ftp (see navigationmanager.cs). If you want to use other protocols, you will have to use another type of menu item, but please keep in mind that the file protocol is unsafe and is not supported by all browsers, for security reasons (see for example http://kb.mozillazine.org/Links_to_local_pages_do_not_work). Even Internet Explorer has stopped supporting it in the Internet zone since IE6 SP1: http://msdn.microsoft.com/en-us/library/aa767731(v=vs.85).aspx

Related

Site wide HTTP Header for Tags

I have just inherited a massive old HTML site that I want to track on Google analytics. It's nearly a 1000 pages of good old '90s html.
I've been running a web server for many years but am not a coder in any particular language although I do edit my PHP config files and my HTML files, install and configure modules in Mediawiki, phpBB and Drupal. I am currently on Svr2016, IIS10. For this HTML site, how would I include the Google tag (or any other tracking tag) in the header on every page served from my IIS console?
I need a pretty cut and paste or point and click solution.
Assuming you’re using IIS and have SSI enabled (SSI= server side include).
I would create an include file (server side include - could be .shtml) and paste the google analytics or tracking.
Then, I would find a file such as footer that’s used by all the other files and include it.
Or maybe put it other common files like navigation that’s used site-wide.
See sample use/issues.
https://serverfault.com/questions/244352/why-wont-ssi-work-in-iis

Making a EXISTING CMS site compatible for mobile site NOT REDIRECT

Making a EXISTING CMS site compatible for mobile site NOT REDIRECT
Hi All.
I am currently creating a mobile version of an expression engine site that we use.
I am having problems with this, because typically I can just use media quires, or use redirect scripts.
However, the layout of the mobile site will be completely different from the desktop, so I can't just fiddle with a media quires for the CSS (as site just looks to different).
I was thinking of using a javascript to wipe the code or markup (php) if the device is mobile BUT it would mean perhaps loading two versions of code anytime a page loads up (not good for mobile). Eg one code for desktop and another for mobile.
I can't change the file names eg (mobile_index) because it is a CMS and the links wont link up correctly. I have tried this a few times , and also editing the .HTACCESS file, but it simply didnt work.
So if anyone knows how do I change the code of a page if the device mobile, but cant change file name, directory or any of that :-)
Cheers
Daragh
Why no redirect? If I was in your position, which I was a few months ago, I would handle this totally different:
Install Multiple Site Manager by ExpressionEngine: http://expressionengine.com/user_guide/cp/sites/index.html
Add another site -- mobile
Give it a proper domainname like m.domain.com
Give it its own template group
... and redirect with http://github.com/sebarmeli/JS-Redirection-Mobile-Site/
Now you can manage both installations from the same CMS and both installations can access existing channels, modules, extensions and members. This will keep your code fast and clean.
Adding a bunch of conditionals will only slow down installation.
Actually you could mess with media queries - it's the most flexible. JS is really overkill for something like this. At larger sizes, UL>LI menus could appear, and at smaller sizes they could be hidden (display:none) and swapped to select lists; divs can be replaced, elements dropped or resized. I also combine them with different snippets or embeds so you can tailor the content out as well.
You might try something like MX Mobile Device Detect. It gives you some variables that can detect if the user is on a mobile device that you could use in conditionals in your templates.

Using the UP1 Mobile Controls how can you create a link to an external web site?

Using the Outline control in a mobile page and setting it's href to a URL doesn't seem to work for me. Moving to another mobile page does in fact work. The older OpenNTF controls used to support this and I am wondering if I am missing something as you would think that this functionality would be supported.
The basicLeafNode is used to create a node that contains an external url.
If your pointing to a different server you need to use the full http:// format.
If your pointing to a different nsf on the current server you can use the /.ibmxspres/domino/filename.nsf format

Virtual directory problem in IIS for asp.net web application

My asp.net web application works fine locally and when I deploy it as the default web site on my test server. So for example, when I type http:// 10.10.10.100 it works fine.
I created a virtual directory called "Test" under my "Default Web Site".
When I type http://10.10.10.100/Test it loads correctly to my log-in page, however when I log-in and click on a link it goes back to my log-in page and the url goes back referencing http://10.10.10.100 instead of http://10.10.10.100/Test/Default.aspx, for example.
My goal here is to run my application from the virtual directory and not as the default, but I don't want to change my code to a hard coded path since then it won't work anywhere else.
Any workarounds for this?
You have left a few unanswered questions, but some things to check:
Which links are you using? In other words, are they plain HTML links (<a href=""> links), ASP.NET links (<asp:HyperLink>), LinkButtons (<asp:LinkButton>), etc.?
How are you specifying the URL in those links? ASP.NET has a "shortcut" for root directory of the website if you use the tilde (~) character. So, to link to a page on your site called "MyPage.aspx", you might use "~/MyPage.aspx".

How do you make a CMS and existing asp.net applications live together peacefully in IIS?

Note: I originally posted this on ServerFault, but I haven't gotten any responses at all. Since it looks like I'm on track to get the Tumbleweed badge over there, I figured I would try here also.
Our existing public website consists of a mish-mash of asp.net pages with mostly static content and some real web applications that are set up as virtual directories. We're now looking at installing Umbraco, which requires that you install it at the root of the website.
Since the CMS would be at the root of the website, I'm assuming it's a bad idea to run our existing pages and web applications underneath Umbraco (due to the URL rewriting it performs and inheriting web.config settings, etc.) So how do we make everything co-exist peacefully both while we transition to the CMS and after we're finished?
My only idea so far was to set up the CMS and the applications as separate websites and then use some sort of URL rewriting/reverse proxy to make everything resolve correctly:
* www.example.com would keep resolving to our old homepage
* www.example.com/dept1 would keep resolving to the old dept1 page
* www.example.com/dept2 would resolve to the new dept2 page on the CMS
* www.example.com/app would resolve to an existing web application
We ending up setting up Umbraco as it's own website in IIS and then we bought ISAPI Rewrite so that we could seamlessly pass through CMS content for certain URLs.

Resources