IIS 7 URL Redirection - asp.net

Well, having a small problem.
A 3rd party is connecting to our API, however they are using the wrong URL and the URL no longer exists on our system. They said the had to revert to some backup code.
Problem is that they have no developer that knows how to fix the code to point to the right URL.
So, my question is how can I take a nonexistant URL in IIS 7 and have redirect to a the correct URL?
URL they are trying to use is (which does not exist):
http://www.mysite.com/page1212.aspx
The URL they need to hit is:
http://www.mysite.com/page1919.aspx
How can I cause the redirection to happen server side using IIS 7.0 only for this? I want nothing to change functionally with the website other than this simple redirection.

Check out IIS URL Rewriting.

Here's also a very detailed tutorial on how to use redirecting on IIS7. Scroll a bit down and you'll find what you're looking for.

Related

How to track url redirects in .Net Application?

When I type http://example.com/load/ in my browser and press ENTER, this website redirects me to several URL's and then I finally landed on http://example.com/load/3/.
These redirection happens at the website end, and I finally landed on this last URL. I know by using firebug or fiddler I can get all these related url's.
But I need to get all these related URL's through my .Net application. Because iam working on an application which should do all the jobs as firebug does. thereafter I need to check the status of each URL's from my application.
Need help to get this code?
Since you need to track these url using your .NET application you can use
HttpRequest.UrlReferrer Property.
Another suggestion would be using
http_referer ex(string referer = Request.ServerVariables["HTTP_REFERER"];)
Take a glance at Page.PreviousPage Property too.

Removing .aspx from URL with an IIS Version 6 server

I have a asp.net application that is running on a server that has IIS 6 on it. I want to set-up a redirect so that instead of my page reading www.google.com/About-Us.aspx it just has www.google.com/About-Us. I've seen in IIS7 where you can just write a rewrite into your web config file, but I'm not having much luck with what to do for IIS6. Has anyone else had this issue as well or know of a work around for this?
Thanks!
You should add URL Routing.
More about that (actually this is a solution you need) you can find HERE
Screenshot of page

Web.config redirect outside traffic for testing purposes

This is a bit of a tricky question.
I am developing a .net website, and it is hosted on our own servers.
I want to redirect outside traffic to a blank "coming soon" page, while our internal network can see the content.
How do I modify the web.config to do that?
I have already tried default document settings, but it doesn't seem to accept those, and instead displays the .NET website.
Please have a look at http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module. It shows how to use IIS URL Rewrite Module (which in turns writes to web.config) to handle your scenario.

Setting Default URL in Web.Config for website (Routed page!)

This is a follow-up on this question.
I basically have the same question as this question, but with a few differences. First of all, my url is http://site/Image/Cassandra/Image.aspx and I want to see http://site/Image/Cassandra instead. This is a routed page where I use ASP.NET routing to translate an url to the one above. But somehow, it doesn't find my page when I don't add "Image.aspx" or anything else ending with ".asmx".
That annoys me...
Since this has to run on both IIS 6 and 7, and because the administrators won't let me have access to the IIS configuration, I need to solve this from within my web application and I think web.config is the place to add the solution. But what is the solution?
(Btw, I know there is some trick with authentication and a default URL in it but that won't work in this case.)
The problem with the URL you would like to have is that IIS6 would require that a physical resource exist on disk, unless you've configured IIS6 to route all requests through ASP.NET. From your statement this would appear to not be the case.
So, assuming that IIS6 is not routing all requests to the ASP.NET pipeline, then there will be no way of providing the exact URL you are wanting.
I encountered a similar dilemma before and overcame it by modify my routes to include a dummy .aspx extension so that IIS6 would be happy. Is there a reason you couldn't modify your desired URL to contain an extension that IIS6 does route to ASP.NET?

iis7 virtual-directory redirect change from iis6

I have an ASP.NET 3.5 application that started in 1.1 and has been ported from IIS5 to IIS6 and now we're going to IIS7. Back in the 1.1 days we implemented URL-rewriting functionality based on HTTP Modules that still works great - fairly complex logic that is very stable. It allows us to take URL's like this
www.abc.com/merchant
and figure out that 'abc' represents a brand of products and 'merchant' is one of many companies that sell that brand. So far so good.
Along the way we have had some merchants close, others merge, etc. To preserve the URL's for them, we will sometimes use IIS6's virtual-directory-redirection capability to redirect www.abc.com/oldMerchant to www.abc.com/newMerchant, or to something else entirely, like www.micorsoft.com - who knows. There are about a dozen of these now.
I am trying to do the same in IIS7 and I've found many posts describing differnet mechanisms (like this). The biggest problem I have is that in IIS7 the virtual root paths STILL go thru my URL rewrite logic, while they didn't in IIS6. That is, instead of redirecting www.abc.com/oldMerchant to www.abc.com/newMerchant, the URL rewriting sees it first and concludes that oldMerchant isn't a valid merchant (as it should).
Before I go down a coding road to solve this problem, does someone know of a magical switch I've missed?
my eyes are rolling back in my head.
That is, instead of redirecting www.abc.com/oldMerchant to www.abc.com/newMerchant, the URL rewriting sees it first and concludes that oldMerchant isn't a valid merchant (as it should).
So, in your rewrite logic, can you not include appropriate redirect rules for the sites you want to redirect? (I'm assuming a redirect is possible in the IIS7 Rewrite Module).
Are you running IIS7 in integrated or classic mode? I expect you are running in integrated mode. That's the new mode that sends all of the traffic through the .Net pipeline. If you switch to classic mode, I think it might start working for you again.

Resources