2

In IIS I have web site with .Net application, accessible like this:

http://site1.example.com/myapp

The site requires authentication, so when I access it, it redirects as expected to http://site1.example.com/myapp/login.asx

I exported the configuration, and then used the file to create a new site under the same server. Now, when I access the new site at http://site2.example.com/myapp, it redirects to http://site2.example.com/MYAPP/login.aspx. Note the upper case for the app name.

Before I imported the xml configuration file, I edited it to set different root directory for the application (where I placed a copy of the existing one), so this is not the problem.

When I look in MetaBase.xml, the AppRoot for the virtual directory in the newly created site was set to /LM/W3SVC/1584782141/Root/MYAPP, while in the exported xml file, as well as in Metabase.xml but for the original virtual directory its lowercase, as it should be.

I edited the MetaBase.xml (in IIS the online edit of metabase is allowed) and saved it. No change at all. I reloaded the Metabase, the correction is in place, but it just don't work - it always redirects to the capitalized version of the URL.

This happens only when redirecting to login.aspx. If I hit directly the login page - i.e. I type the url in the browser, it stays as I typed it.

Also, if I hit a "not protected" page in the directory, it keeps the case as it should.

Any idea where else I can look to fix that issue?

Sunny
  • 5,834
  • 3
  • 22
  • 24

2 Answers2

3

I have found the exact same issue, with IIS 6. I have found a few references to this issue elsewhere on the web; I don't think too many people do this to have run into the bug. The fix is to allow direct edits to the metabase, and then edit it to change the AppRoot to have the correct case.

Which, you say that you have done. It always works for me; this is how we deploy new customers in our environment. Try recycling the application pool, and make sure you flush the cache and cookies in your browser(s).

mfinni
  • 36,144
  • 4
  • 53
  • 86
  • That was the case - restart of the AppPool. I was under the impression that if you edit the MetaBase, it'll restart the applications. Very strange. – Sunny Jul 27 '11 at 20:06
  • Nope, editing the metabase does not do anything like that, which could be considered good or bad. – mfinni Jul 27 '11 at 20:55
1

I agree with mfinni's comments. What you did should have worked. It will only occur when a redirect occurs, so it won't happen if you hit a URL directly, but it will when ASP.NET does a redirect to the login page.

What I suggest is to search the rest of the metabase for other references. You may have caught one of two. Then do an app pool recycle (iisreset as a last resort). As long as you confirm that uppercase MYAPP doesn't exist in the metabase then you should be set after the app pool has been recycled.

Scott Forsyth
  • 16,449
  • 3
  • 37
  • 56
  • Scott - have you experienced this before? The process of importing which mangles the AppRoot into UPPERCASE should be a bug, right? I have never bothered opening a case for this; neither have I ever seen it documented by MS. – mfinni Jul 27 '11 at 14:41
  • mfinni, I haven't run into this specifically. Do you know what was used to create a vdir? It's probably whatever tool is used to create the vdir that causes it to be uppercase. The reason that it's shown in the browser is that ASP.NET uses the IIS application name in the redirect and it just honors whatever is in IIS. So I would think that the root cause is the tool creating the vdir. I don't believe that IIS Manager would case that so my assumption is that it's another installer or another tool that does it. – Scott Forsyth Jul 27 '11 at 15:09
  • In my scenario, a VirDir was created with the proper case by an application. Just as described by Sunny, in IIS I saved the VirDir as an XML file, which had the proper case. Then, in IIS, I made a "new VirDir from file", using that XML. The AppRoot of the new VirDir in the metabase is all uppercase and that screws up the redirects. So, in my case and Sunny's, we're only using features built into the IIS MMC. – mfinni Jul 27 '11 at 15:32
  • It's very easy to recreate; if you have an IIS 6 machine handy, you can see if you can recreate it. – mfinni Jul 27 '11 at 15:32
  • 1
    I see what you mean. I just confirmed the same. Yes, it does look like a bug, or at least as assumption by the programmer than uppercase is a safe setting ... which you and Sunny have confirmed isn't the case. This is only an issue if you export a vdir+application since it's the AppRoot element that is updated incorrectly. I also confirm that it does this if you overwrite or allow the wizard to rename to a new name. – Scott Forsyth Jul 27 '11 at 16:24
  • Woot! The sweet taste of vindication! – mfinni Jul 27 '11 at 16:34
  • 1
    I didn't mean to seem like I was challenging your comments, but it's certainly confirmed and reproducible. :) – Scott Forsyth Jul 27 '11 at 19:04