Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I use FileExists  in ASP  to check files on different server ?

Posted on 2004-09-27
6
Medium Priority
?
799 Views
Last Modified: 2007-12-19
I need to create a folder on a different server with asp, I tried server.mappath but it does not like the path I give it

How can I accomplich this...

<%
Dim FSO,F

Set FSO=Server.CreateObject("Scripting.FileSystemObject")

If FSO.FolderExists(Server.Mappath("//ab/sharedFolder/Customers/NameofFolder")) then
        Response.Write "Folder Exist"
Else
        Set F = Fso.CreateFolder(Server.Mappath("//ab/sharedFolder/Customers/NameofFolder))
        Response.Write "Folder was created"
End If
%>
0
Comment
Question by:JonMny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Expert Comment

by:mistyrae
ID: 12160823
Hi,

You can map a path to a location on another server. The server.mappath function is only to turn relative paths (from within your website) into fully qualified paths.

Provided your website is running under and account that has the proper permissions to the remote server, you can check FolderExists on a UNC path, like:

If FSO.FolderExists("\\myservername\mysharename$\myfolderpath") Then
  .....


- misty
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 1500 total points
ID: 12160855
Also, it will be necessary to duplicate the IUSR account on the other server or else you will get a permissions error. Please see:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q184566

FtB
0
 

Expert Comment

by:ashaydo
ID: 12160893
Server.MapPath Returns the physical path based on the web path passed:

  strWebRootPath = Server.MapPath("/")
  strCurrentPagePath = Server.MapPath("./")

Is ab your other server in this case?
If so, you'll want the folderexists method to look like this:
  FSO.FolderExists("\\ab\sharedFolder\Customers\NameofFolder")

If you want see if your folder on the current server exists on the other server:
  FSO.FolderExists("\\otherserver\Replace(Server.MapPath("/Customers/NameOfFolder"), ":", "$"))
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 9

Author Comment

by:JonMny
ID: 12161106
Okay , I am not able to get the permissions I need for the server to be able to do this.

Would it be possible to Create the folder using the users credentials, Or can I hav a script that runs on the user side somehow
0
 

Expert Comment

by:ashaydo
ID: 12161129
In IIS, if you turn on Windows Authentication and turn off Anonymous authentication, the user's credentials should be the ones being used.

The user would then, of course need to have the appropriate rights to the path that you are specifying in the FSO.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12161156
Please see the link that I provided above.

FtB
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question