Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to get Virtual Path of Web Service [modified]

How to get Virtual Path of Web Service [modified]

Scheduled Pinned Locked Moved ASP.NET
questionwindows-adminhelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samrat net
    wrote on last edited by
    #1

    Hello Friends! I've faced a probelm. pls help me. I am trying to verify whether the path to the webservice hosted in iis is valid by the following code. HostingEnvironment.VirtualPathProvider.FileExists("http://localhost/WSClientProxy/teste.asmx"); But every time it displays "'http://localhost/WSClientProxy/teste.asmx' is not a valid virtual path." How can I get the virtual path? Thanks!

    modified on Tuesday, April 8, 2008 12:25 AM

    C 1 Reply Last reply
    0
    • S samrat net

      Hello Friends! I've faced a probelm. pls help me. I am trying to verify whether the path to the webservice hosted in iis is valid by the following code. HostingEnvironment.VirtualPathProvider.FileExists("http://localhost/WSClientProxy/teste.asmx"); But every time it displays "'http://localhost/WSClientProxy/teste.asmx' is not a valid virtual path." How can I get the virtual path? Thanks!

      modified on Tuesday, April 8, 2008 12:25 AM

      C Offline
      C Offline
      Christopher Duncan
      wrote on last edited by
      #2

      Hi, Samrat. The problem is that you're trying to use a file system routine (FileExists) with the virtual web url path that the browser uses. As you might suspect, these are completely different things. MapPath() (I think it's in the Server namespace) will take a virtual path like "~/WSClientProxy/teste.asmx" and give you back a physical path to the filesystem. For example, MapPath("~/WSClientProxy") will give you the physical directory pointed to by this virtual path. You can then use that directory to create files, etc. and of course you can use MapPath("~/WSClientProxy/teste.asmx") as the parameter to FileExists(). If you play around with it and do some tests with creating, renaming (MoveTo()) deleting files, etc., I think you'll get the hang of it. Hope this helps!

      Christopher Duncan Author of The Career Programmer and Unite the Tribes Coming soon: Got a career question? Ask the Attack Chihuahua! www.PracticalUSA.com

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups