ISAPI Rewrite With Azure Web App - asp.net

I'm not sure if this is the best/correct place for this type of question. But I have an existing .NET website which I am moving from our dedicated EC2 server to an Azure Web App.
However, this current site uses an .htaccess file with about 200 redirects (301 from old urls to new ones) which is powered by ISAPI rewrite (Which was installed manually on the Win2008 server).
I need to keep these redirects, but wondering how everyone else deals with permanent Url redirects on .NET applications when moving to an Azure Web App (From a dedicated server that had ISAPI rewrite installed)?
Putting them all in the web.config seems a little odd to me? And I don't know how that would affect performance?
Any advice or pointers would be appreciated as always.

I always put them in the web.config.
If you think it will be too messy, you can put them in a separate file and use the configSource attribute to link to the file.

Related

Extensionless URL in ASP.NET 4.0 on IIS6

I have a ASP.NET 4.0 WebForms webapp running on a IIS6 webserver. I'm not allowed to make any changes to the webserver. I have a flex app embedded in this file called:
myapp.contoso.com/mysubapp/mysubapp.aspx
I'd like to only require the user to use the URL:
myapp.constoso.com/mysubapp
to reach the application and essentially hid the mysubapp.aspx permanently. I've been checking out URLRewrite and URLRewriting.net... It all looks to be a little much for this once instance in which I need it (if I need to add more rewrites in the future I'll use one of those frameworks). Is there a simple way to achieve this? I've checked out similar posts... it seems that I may need to write a simple one myself?
URL Rewriting using iis6 with no extensionless urls
How to deal with extensionless Url in ASP.Net and IIS6
The simplest thing I can think of is to rename your web page from mysubapp.aspx to default.aspx. This will allow users to request myapp.constoso.com/mysubapp and get your page. This should work if you have not removed default.aspx from the default document list in IIS.
Alternatively, you can add mysubapp.aspx to the list of default documents in IIS.

Is there a way I can redirect/rewrite URLs is IIS 7 when the application runs the .NET Framework 1.1?

Is there simply a way I can update the web.config file to rewrite or redirect URLs without making code changes to the project?
Before IIS7 came out, I used a URL Rewrite Module from Helicon to do similar things. It's based on regex for the rules, but it's pretty good and it always worked well for me.
It's an ISAPI module, so it's configuration is outside of web.config.
I used the ISAPI_Rewrite_Lite product, which is free. I never used the full-blown version.
I hope this helps.

ASP.net/MVC file upload with URL rewrite enabled

I came across this interesting problem with an ASP.net MVC website, there is an Action method to process uploaded files and it works fine with cassini webserver but when I tried with IIS in my hosting machine the upload fails, after spending lot of time I noticed that it is because of the URL rewite rules inside set to change the incoming URLs to lowercase and add a trailing slash at the end.
Is there any recommendations to avoid problems like this?
This might sound simple but it would work. Generate your routes so they match your production environment rules. By doing so you'll keep the server from redirecting and causing your issue.

How to rewrite to a virtual directory with a different application

I have a CMS application that manages multiple websites, today whenever i change the codebehind of one of these websites - i have to rebuild the dll for all websites, deploy it - this disconnects all current sessions and is really bad.
The iis is configured to listen to all domain requests, if the request is to one of the websites' domain , the application rewrites it, or example, if someone requests for http://www.example.com, and example.com is configured in the application to be website 12, it is rewritten to http://www.example.com/websites/12/default.aspx.
This is done for all websites.
We want to seperate the dlls of the websites from each other, and from the main CMS, we have a virtual directory to each websites, but when trying to rewrite to it, we discover that IIS support this (we get an "Could not load type '_12._Default'". error).
How can we perform this rewrite so it does rewrite to virtual directories, or if anyone has any other solution for the initial dll seperation problem.
Thanks in advance
You can easly do it with iis7
http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/
You could use a utility like http://iirf.codeplex.com to achieve this. It's easy to install, improved over past versions, and the owner of the project does respond pretty quickly to questions. Best of all, it's free, and supports global/virtual directory rewriting.
HTH.

How do I add a servlet to an existing website with IIS7 and Tomcat6?

I've configured IIS7 and Tomcat6 successfully with the isapi redirector. I can get my servlets from tomcat's examples, and also my own servlets running from localhost.
http://localhost/examples/servlets/ works fine for the supplied tomcat examples.
How do i add servlets to existing web sites?
I've tried adding a virtual directory to my website, the same way i did for the Default Website, but i get 404 errors
thanks
You shouldn't be adding anything to that directory or root. The proper way to do it is to create your own servlets and package them in a WAR file. That will give your project its own domain/context and keep your servlets separate from others.
Given that, you'll have to tell IIS how to redirect requests for your new context over to Tomcat.
This will work if http://YourSite.com:8080/YourWebApp works. If that doesn't work, you probably have the same problem I was looking to solve.
IIS has an HTTP Redirect module that may do what you're looking for. In the IIS Manager, go to your folder in your existing website that you want to redirect to your Tomcat apps. (Make a new folder if needed.) Look for HTTP Redirect in the features view. It's straightforward after you double-click it. It will redirect browsers anywhere you want, but the new URL will not be hidden or an alias.
If it's not there, you need to install it. If you're using Windows Server 2008, use the Server Manager to add the Role. If it's Windows 7, use "Turn Windows features on or off." It's in one of the folders under IIS.

Resources