Disable Umbraco aspx handling - umbraco

I have a project where I want to use Umbraco only for the backend as a CMS. But I want to disable it completely in the frontend handling my aspx pages for me, and I want to use the API to get the content I want. In other words, I want to create an aspx page manually which will not be handled by the Umbraco engine. Right now, if e.g. you create a test.aspx page and put it in the root folder, it will return 404 because Umbraco will look for a node with this alias.
Ho do I disable the .aspx handling by Umbraco, but still be able to use Nodefactory etc. in codebehind to access the content?
Thanks
Themos

There are a few ways you can override pages so that their URLs are not "caught" by Umbraco, you can do this by modifying the following appSettings items in the web.config file.
To add single files:
<add key="umbracoReservedUrls" value="~/myfile.aspx,~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx" />
To add whole subdirectories:
<add key="umbracoReservedPaths" value="~/myfolder,~/umbraco,~/install/" />
You should be able to add ~/ to umbracoReservedPaths which would disable all URL mappings, I just tried it and it seemed to work. But I can't vouch that it'll have no unintended side-effects on the running of the Umbraco CMS.

Related

Redirecting legacy URLs in DotNetNuke

We are building a revamped version of our old site in DotNetNuke. There are many pages that link to pages on our old site and we would like those old URLs to still lead to relevant information on the new site. The old URLs end in a variety of extensions, and sometimes in no extension (our old site is a mishmash of several platforms as well as static files). Does a DNN plugin exist that allows for such redirects? Friendly URLs aren't entirely adequate.
note: I realize that this could be handled in IIS, but we would like our non-coder, non-admin site manager to be able to handle this dynamically.
You will probably want to use a Module like this
http://www.dnnsoftware.com/forge/open-url-rewriter-for-dnn-dotnetnuke/view/extensiondetail/project/openurlrewriter
There is another option though. You can actually put URL records into the database directly, I believe you would simply add a record to the TabUrls table, the TABID is the page in DNN you want to point to. Then you put in the URL, and the HTTPStatus of 301.
You could do that for all the old pages if you know where they need to be mapped to in DNN.
You have to force all request through the ASP.NET pipeline, and you can do that by adding only this single line to the web.config of your application:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

Configurable default view layout

In Asp.net MVC Razor we can use the _ViewStart.cshtml file to define the default layout for our views. That is fine, but why did we loose the web.config setting that was available with web forms engine in system.web > pages.masterPageFile setting?
Why is that important? Because web.config allow automatic environment transformations.
Manual solution
Of course we can put the default layout name in either appSettings and refer to that in the _ViewStart.cshtml or if we have application specific configuration section add additional property which makes things a bit more clear and polished...
But is there any other way that doesn't include code?
Asp.net MVC team should add the layoutFile configuration setting to system.web.webPages.razor > pages element, shouldn't they?
The main question is
Am I missing something that is built-in and I don't know about? Something that requires no code at all similar to WebForms engine?
Asp.net MVC team should add the layoutFile configuration setting to
system.web.webPages.razor > pages element, shouldn't they?
Feel free to open a ticket on the MS Connect site.
But while waiting for your ticket to be analyzed by the development teams and probably added in a future version of the ASP.NET MVC framework and the WebPages you could always do the following in your _ViewStart.cshtml:
#{
Layout = ConfigurationManager.AppSettings["Layout"];
}
and then define the layout in your web.config file:
<appSettings>
<add key="Layout" value="~/Views/Shared/_Layout.cshtml" />
...
</appSettings>
Another possibility is to write a custom razor view engine in which you set the layout dynamically.

How do I display a Web Forms page from an MVC 2 application?

The Report Viewer control apparently only works in a Web Forms page (I'm using MVC 2). So, I make one, add my report to it, and try making a link to it from one of the Views in my MVC 2 site. I consistently get the error "The resource cannot be found". I've tried every possible URL I can think of it get it to work. I even dragged and dropped a Hyperlink tool into the page and set it to link to the Web Form in question and got the same results.
The Web Form is in the /Views/MaintenanceReports folder. I've tried URLs such as ~/Views/MaintenanceReports/DriverList.aspx (with and without the *.aspx) and a few others. But, I'm very sure this should be the URL.
I also added this page route to the Global.asax file in hopes that it would do something magical routes.MapPageRoute("DriverListing", "MaintenanceReports/DriverListing", "~/Views/MaintenanceReports/DriverListing.aspx");
I also tried adding, per the suggestion of one of my fellow programmers, an iframe to an MVC View that had the Web Form in question as its source. This also gave me the same error.
I've got the book Pro ASP.NET MVC 2 on hand and it doesn't give me anything that helps. It basically says that there shouldn't be an issue.
The server runs IIS 7 and has the .NET 4 framework installed.
Normally I'd spend more time looking for an answer, but I'm quite pressed for time currently. This is my last day here (internship) and I'd like to get this last thing done before I leave.
Thank you for all your help.
Try using the StopRoutingHandler. I think the issue is you need to tell MVC to ignore those urls.
routes.Add(new Route("MaintenanceReports/{*resource}",
new StopRoutingHandler()));
Update
It looks like the above doesn't work for routing within the Views folder. The simple solution is to move the WebForms out of the Views folder, and the WebForms work out of the box alongside MVC.
You can also add this line into to display a .asxp page
<httpHandlers>
<!-- see below -->
<clear />
<add path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory"/>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
</httpHandlers>

Does Umbraco allow non-umbraco subdomains

Hi I am installing Umbraco to the root directory of my website. And also I want to install my wordpress blog to a subfolder in the root directory.
However any request to the subfolder is being intercepted by Umbraco and it is showing that document URL cannot be found. Is there a way to make Umbraco ignore certain subdomains?
You can tell Umbraco to ignore certain paths or folders in the web.config.
You need to update the following entry in the appSetting section of the web.config:
umbracoReservedPaths
Add the subfolder you wish Umbraco to ignore in there.
i.e.
<add key="umbracoReservedPaths" value="/umbraco,/install/,/wordpress/" />
There are more details on the Umbraco web.config settings in on our.umbraco.org
it's useful for binding too:
<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/http-bind/" />
~/http-bind/
Thanks Tim Saunders
You can also use umbracoReservedUrls to tell umbraco to ignore specific pages:
<add key="umbracoReservedUrls" value="/mypages/regular-page.aspx" />
This can be set up with in IIS by setting up the blog as a separate application with in the umbraco site.
However if you are trying to make a sub-domain there is no reason why this should be in the same site, I would say it is best to create a separate site with in IIS or purchase another hosting account to host the blog separately

ASP.NET MVC Application in Sharepoint 2007 virtual directory

I have MOSS 2007 installed at lets say http://localhost:4999/ and I want to have my custom ASP.NET MVC (1.0) application at http://localhost:4999/mvcapp/ - logic dictates that, in IIS, i should create a new application virtual directory under my MOSS site and point it at my custom MVC app.
I've done this and it works for executing my controllers etc, however, none of my /Content content is being returned! All referenced images, javascript and css aren't retrieved.
If I put this app into it's own site, or a virtual application within a non-sharepoint site, this works fine and pulls down the images, js and css as normal.
Note - I'm creating a new application in IIS, not just a virtual directory and I have no requirement for integrating with sharepoint, I just want it to have the same domain and port number.
Any ideas?
Cheers
Tony
** EDIT **
To clarify - the URL's that are being generated aren't the issue - they are correct and are being generated in the same way as they would be if this wasn't hosted under sharepoint. IE: /mvcapp/Content/Scripts/jquery.js etc.
** EDIT 2 **
More clarification - the MVC app has it's own web.config file - but it appears that when using a virtual directory withn a sharepoint site, many of the handler mappings still get pushed up to the child site (Note: This is a virtual directory configured as a seperate application not just a virtual directory).
Whilst I don't want or need SharePoint integration, I need my MVC app to come from the same domain and port to overcome some cross domain issues (a lot of MVC content is iframed into sharepoint in various ways). So sharepoint would be at http://site and my app at http://site/mvc
I would keep them on separate web sites (MVC and SharePoint that is). You could create a new website entirely for your MVC app, and then through IIS, right click your MVC web site, edit bindings, and redirect the traffic from your MVC website to URL you want.
I set up a couple of WebForms apps to run in much the same way you say that you want: a separate virtual application with its own web.config, etc. I had to tweak the web.config to make it work, though. My app uses things like session state and view state, but I reckon those aren't applicable to your MVC app. As I look at my web.confing, I think this section might be applicable for what you're trying to do:
<location>
<system.web>
<xhtmlConformance mode="Legacy" />
<trust level="Full" />
<httpModules>
<remove name="PublishingHttpModule" />
</httpModules>
</system.web>
</location>
Hope that helps. I also have an <authorization> section in there, but it wasn't necessary to make the app work.
Look at the following:
Configuring Specific Files and Subdirectories (MSDN)
Disabling Configuration Inheritance For ASP.NET Child Applications (Blog)
HTH

Resources