ASP.NET MVC website NOT in virtual directory - asp.net-mvc

I have deployed three mvc pages to my server as virtual directories using IIS (which there are plenty of tutorials for). I need one of the apps to run when the base URL is requested. So, for example, I have a Help app which can currently be accessed via help.contoso.com/help but I want that app to run when a user simply goes to help.contoso.com instead. I gather there is some sort of redirect option but can't find an example for this type of request anywhere (they're all way more complicated and don't address my simple need). I also think there should be a way to just host the app as the 'root' web 'page' but can't find anything around that either...

Related

Can I run an ASP.NET app in a virtual directory under an OrchardCMS instance

As the title suggests, we are tasked with running a custom .NET MVC application in a virtual directory under the client's Orchard CMS installation. Now, I've successfully done this type of thing in the past with two custom .NET MVC applications, but never with Orchard. Orchard does some unique things behind the scenes, so I do not believe it would be possible.
Two things:
1. I can't build a new Orchard instance from source.
2. It must be a virtual directory on the same domain for SEO purposes. Running the site on a subdomain is bad for Google rankings. Therefore http://www.example.com/myportal is good, whereas http://myportal.example.com is really bad.
Yes you can. While this isn't specific to Orchard, you're likely going to run into some issues with web config inheritance. Depending on the individual scenarios you face (such as shared assemblies but different versions...duplicate config nodes etc) you should be able to search around on stackoverflow and resolve those easily though.
Resource: Virtual directory inside Orchard web application

Host website one webfolder down

I want my site to be hosted like this:
mysite.com/en/default.aspx
mysite.com/en-gb/default.aspx
mysite.com/de-ch/default.aspx
Originally I just hosted the site in application folders in IIS for each culture I support and everything was fine. I had a separate application in the root which forwarded the user to the appropriate culture. This was all grand.
However, now we're going to host with Azure and I need to get my site to fit into one web role (for those not familiar with Azure, just think of it as me only being able to host the website once - so no application folders). To this end, my site correctly collects the webfolder for the culture and sets the threading appropriately, all this is fine. My problem is that now as far as IIS is concerned the page 'default.aspx' does not exist in the folder 'en-gb'. That folder doesn't really exist. I need to get my site to ignore that first webfolder when it considers what content to get.
It's an interesting one, I suspect my solution lies in URL rewriting. Does anyone have any advice on this?
Thanks for the help!
Well I have found the answer.
It turns out that a web role is capable of much more. I understood that it was a web site running under a virtual machine, but that virtual machine could be torn down and moved at any point. However there is a facility to control what is going on in IIS on that virtual machine within your project. By editing your ServiceDefinition.csdef file you can add virtual applications and virtual directories. More details here:
http://www.dotnettwitter.com/2012/03/publishing-multiple-sites-sub-sites.html
I didn't need to use any fancy URL rewriting. I now have several sites running under one web role.
Well... I will do once I figure out what is stopping my main site working under Azure, but this question is answered.

ASP.NET MVC - Creating SAAS framework

I currently have a ASP.NET MVC 2 web application and would like to enhance the architecture to support a SAAS model. I plan on eventually building a number of web applications so would like to design the system accordingly.
The goal would be that when a client would hit the following url clientxyz.domain.com they would see an image of all their subscribed applications. This would essentially be a web page with a bunch of application icons. Once a client would click on a icon it would navigate to that actual web app at the following example url clientxyz.domain.com/application_name.
We currently use GoDaddy to host our domain and plan on using a Cloud based iLand server to host our application. We only plan on a few new clients a year due to the nature of our software.
I have a number of questions:
Is it possible to programmatically create subdomains on the fly using a .Net api. I'm pretty sure GoDaddy does not let you do it. So is there another provider that would let me create subdomains via C#. This may be the wrong approach and may not even need to physically create client subdomains. Instead I may be able to accomplish this using url rewriting in IIS/MVC?? If I use rewriting, it would have to satisfy the url requirements mentioned above. Any suggestions/links/examples?
Should I create a separate IIS website for each tenant/client? Or should I use URL rewriting and simply have a single website / application pool? Looks like you can programmatically spin up IIS websites (example: http://www.eggheadcafe.com/tutorials/csharp/d4bba585-b517-4834-8476-ff05b085d86e/iis--create-app-pools-virtual-directories-and-web-sites-c-net.aspx)
Since we are using a Virtual Server on iLand do I simply have to point GoDaddy to the nameserver at iLand.
I would like to automate the entire new client process if possible. To accomplish this, I would have to created the database (probably going to have single db per tenant), populate the global client/tenant table, create admin user account and subscription details in newly created database and create subdomain depending on approach. Am I missing anything?
thanks in advance.

URL/ Path in address bar

I have seen my websites only shows path as below when you navigate to different webpage or items in that website while when i created the website i have to create a webpage for everything & it do show the path with file name like .php while other websites only show a path even though it navigate to new page.
This is known as URL routing. The developer has configured the webserver (or web application) to map specific URL paths to individual webserver pages (.php, .aspx, .mvc, or whatever). There are different ways of achieving this, depending on the webserver platform technology, but it is generally achieved by configuring a url route map of some kind. There are several advantages to organising a website url's in this way but mainly it makes URL's more consistent and easier to understand for users, and hides the details of the website's underlying implementation.

Hide _layouts path in a web application deployed on SharePoint 2007

We are building a new web application that needs to run inside the SP Context for authentication. Unfortunately the person logged into the machine is not necessarily the person logged into SharePoint. I could not figure out a way to detect who was logged into SharePoint from an application outside of SharePoint. So, the solution is to deploy the application to the LAYOUTS folder within the 12 hive. This works great in that I can use a custom master page, go crazy with fancy user controls, AND be within the SP Context. I also locked down access to the page by detecting which web app the user was on so no one can access it from a different SP web app.
The problem is the URL. It is ugly. I want the url to be something like this: www.sitename.com/ instead of www.sitename.com/_layouts/appname/
I tried created creating a new web site within IIS that points directly to the app in the LAYOUTS folder. That failed because I was no longer within the SP Context.
I also tried an IIS redirect which worked, but the URL still switched over to the ugly URL.
Does anyone have any ideas for this?
My orginal problem was not being able to detect the currently logged in user for SharePoint outside of SP, so if you have a solution to that problem, that would be great too.
Your best option is to rewrite the URLs and HTML with a proxy. Apache with the mod_rewrite and mod_html_rewrite options are an option. However this kind of setup is not trivial.
You can use URL rewriting in IIS.

Resources