0

I am trying to implement a Classic ASP Project on II8.5 on Windows Server 2012 R2.

While launching the DashBoard.asp, Getting error

Object Doesnt Support Property or method : Server.MapPath("\")

The Project is working fine on IIS7.5 on Windows 2008 Server R2. But Failing on II8.5. Have Done all the respective setting Required for Classic ASP to execute on IIS8.5 server, Still getting the same issue.

Can Anybody Guide, Why Server Object Methods are not getting recognized on IIS8.5?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
KITIAN
  • 1
  • 1
    `Server.MapPath()` takes URL paths and converts them into physical paths. "\" is a physical path character you should be using `/` instead to denote the root of your website. – user692942 Oct 26 '15 at 10:09
  • Just to clarify I'm not saying that is the issue just that you should use `/`. not sure that would cause a `Object doesn't support this property or method` error though. – user692942 Oct 26 '15 at 11:01

1 Answers1

0

Edit: New approach

looking at the code, you have following line that fails in global.asa Application_OnStart:

Call setXDefInApplicationScope(Server.MapPath("fb/infra/server/XDef"))

Maybe setXDefInApplicationScope is not defined in this context, but resides in an included file that does not apply in Application_OnStart

Edit: second option (ruled out by comments)

I would guess, you have created a variable named "server" in the context, that overwrites the Server object you think you are using.

    class clsServer
        public foo
    end class

    dim server

    set server = new clsServer
    Response.Write Server.MapPath("/") ' will raise the error

I guess, it may not be that obvious in your setup, could be in any included file. More importantly, if you did not specify option explicit as you should, there must not even exist a dim.

gpinkas
  • 2,291
  • 2
  • 33
  • 49
  • No, I haven't declared any local variable named Server. In my global.asa, i am trying to set Application scope using the Server.mapPath. But its not getting recognized on IIS8. The same piece of code works well on IIS7.5 on Windows 2008 server. The Code that is failing is as following: – KITIAN Oct 28 '15 at 11:20
  • – KITIAN Oct 28 '15 at 11:29
  • While Debugging, Methods are seen inside the Server Object, but while accessing Server.MapPath("fb/infra/server/XDef") gives Object Doesnt Support Property or method error – KITIAN Oct 28 '15 at 11:32
  • Oh, then maybe look here: http://stackoverflow.com/questions/496524/classic-asp-server-mappath-doesnt-work-as-expected-in-global-asa – gpinkas Oct 28 '15 at 13:44
  • The error still doesn't make sense. Can you output `typename(Server)` on the occasion, before the error occurs? What happens when you remove the `on error resume next`? – gpinkas Oct 28 '15 at 13:54
  • It is still giving "Object Doesnt Support property or method". I also tried removing server.MapPath and tried reading the path from registry key. Even the WSHShell.RegRead( strRegistryKey ) is returning error "Object Doesnt Support property or method". Really Confused now.. Not sure what is causing the problem – KITIAN Nov 05 '15 at 13:12
  • The output of TypeName(Server) is "IServer" – KITIAN Nov 05 '15 at 13:18
  • `IServer` is the correct default. So this option is ruled out I'm afraid. Are you sure about the error occurrence in this line, disabled "on error resume next"? – gpinkas Nov 05 '15 at 13:39
  • On removal of on error resume Next Below is the ouput Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'Server.MapPath' /LM/W3SVC/1/ROOT/BRN9999/global.asa, line 141 – KITIAN Nov 07 '15 at 12:52
  • I tested the Application_OnStart code you provided successfully in a IIS 8.5 environment. Error in line 141 seems too high for the code you posted. I assume you have functions defined beforehand, but maybe the error is not where you believe it is? – gpinkas Nov 09 '15 at 09:32
  • The issue Got resolved. The issue was not with IIS8.5 but Windows 2012. The problem was with registry entry of kernel32.dll of Windows2012 OS. Somehow it seems to have got changed. After setting it to below, my project is working fine now: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Sorting\Versions] @="0006020E" "000602xx"="kernel32.dll" "000601xx"="SortWindows61.dll" "FF0000xx"="SortServer2003Compat.dll" "FF0406xx"="SortWindows6Compat.dll" "FF0502xx"="SortWindows6Compat.dll” Thanks a lot, appreciate your guidance!! – KITIAN Nov 17 '15 at 07:03
  • Wow, good it's resolved now. I'm sure it was great fun to debug this... :) – gpinkas Nov 17 '15 at 13:31