473,769 Members | 2,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Virtual FTP Folder in ASP.NET

Joe
I've been running into problems when trying to create a Virtual FTP folder
in ASP.Net. I've tried it a few ways but none of them has worked so far. I
have identity impersonation turned on, and the current user is an
administrator on the machine, so I wouldn't think it's a permissions issue,
but I can't think of anything else that it might be. The first way I tried,
which worked fine in ASP but not ASP.Net, is:

Dim Path
Dim ftpSvc
Dim vRoot
Dim vDir
Dim Site As Object
Dim ftpSite As Object

Path = "c:\inetpub\www root\test\folde r" ' assume this folder already
exists on the server

ftpSvc = GetObject("IIS://localhost/MsFtpSvc")
On Error Resume Next

For Each Site In ftpSvc
Response.Write( ftpSvc.Class & "<br>")
Response.Flush( )
If ftpSvc.Class = "IIsFtpServ ice" Then
ftpSite = Site
Response.Write( "setting vroot...")
Response.Flush
vRoot = ftpSite.GetObje ct("IIsFtpVirtu alDir", "Root")
If Err.Number = 0 Then
Exit For
Else
Response.Write( Err.Description )
Response.Flush( )
Err.Clear()
End If
End If
Next
ftpSvc = Nothing

On Error GoTo 0
If True Then
vDir = vRoot.Create("I IsFtpVirtualDir ", sUser)
If Err.Number = 0 Then
vDir.AccessRead = True
vDir.Path = Path
vDir.SetInfo()
End If
End If

The above code worked fine in ASP, but when I tried to run it in ASP.NET, I
got the following error:

<<
Cannot create ActiveX component.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Exceptio n: Cannot create ActiveX component.

Source Error:
Line 76: ftpSvc = GetObject("IIS://localhost/MsFtpSvc")


I have also tried the following:

Dim deRoot As New DirectoryEntry( "IIS://localhost/MSFTPSVC/1/Root")
Dim Path As String = "c:\inetpub\www root\test\folde r" ' assume this
folder already exists on the server

'Try
deRoot.RefreshC ache()
Dim deNewVDir As DirectoryEntry = deRoot.Children .Add(sUser,
"IIsFtpVirtualD ir")

deNewVDir.Prope rties("Path").I nsert(0, Path)
deNewVDir.Commi tChanges()
deRoot.CommitCh anges()

' Create a Application
' Save Changes
deNewVDir.Commi tChanges()
deRoot.CommitCh anges()
deNewVDir.Close ()
deRoot.Close()

'Catch ex As Exception
' Response.Write( ex.Message)
'End Try

but this didn't work either. I got the following error:

Object already exists
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime. InteropServices .COMException: Object
already exists

Source Error:
Line 47: deRoot.RefreshC ache()

It would seem the error is occuring in both examples around the same place -
where it first tries to get the object for the MsFtpSvc.

What do I need to change to make this work?

Jul 21 '05 #1
0 1390

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2014
by: dave | last post by:
I am using vs.net 2003 on windows xp. After clicking on a project within my solution and selecting create new folder vs.net responds back with , the "directory already exists". If i look at the virtual directory on my pc the directory does not exist. If i create the folder from explorer then select hide/show files within vs.net I see the directory I just created. When I include that directory in my project by right clicking and selecting...
0
2281
by: Ken Wigle | last post by:
All, I am trying to add some .net applications I wrote to a virtual directory underneath the sharepoint services web site. I am having some problems and wondering if a) this is possible and/or recommended and b) if there is another way. I want to add the projects under the sharepoint site as I want authentication but do not want my users to have to login everytime they access a net app from within the sharepoint site. Ideally, they...
3
1514
by: news.iq.ca | last post by:
Hello. Under C:\Documents and Settings\Administrator\My Documents\My Projects\ I have created a folder, "ASPNET" where I plan to keep my projects. I have started Administrative Tools -> Internet Information Services and under "Default Web Site" I have created a virtual folder with the label
7
2396
by: Jaydeep | last post by:
Hi, Anybody knows how to create virtual directory programmatically under root directory ofcourse from code-behind. I am developing web-based application where I need to create a folder and making this folder as virtual directory in IIS. I know in ASP how to do it. Set objIIS = GetObject("IIS://localhost/W3SVC/1/Root") objIIS.Create("IISWebVirtualDir", strVirtualDirectoryName)
3
1958
by: epigram | last post by:
I've been creating some toy ASP.NET apps in an effort to understand the technology. I've something odd with regards to project/solution creation. If you create a new asp.net application, it appears that the project files get created in the URL specified Location field on the New Project dialog box. This makes sense to me. What is confusing is that the solution file gets created in a folder with the same name as the location folder (the...
1
1802
by: Eric Voigt | last post by:
are there special settings applied to IIS5, when creating a webService in VS.NET? I wonder - because when I create a webService (let's call it webservice1) using VStudio.NET on my remote W2K IIS5 it works fine and without any problems. When I don't use the VStudio.NET Wizard but only copy the .asmx and bin/*.dll files to another web (on the _same_ server) it won't work! I double-checked every setting in IIS and NTFS and can't found any...
5
3502
by: Sam777 | last post by:
I was under the impression that creating the app_offline.htm file at the root of the webapp would cause all handles to be closed so that the app could be removed. Unfortunately, this isn't the case. One handle remains open. Debugging shows that it's actually the IIS cache and not ASP.NET that owns this handle. During IIS shutdown, the handle is closed with the following stack trace: ChildEBP RetAddr 0006fbe4 5a403e05...
15
2836
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. Everything is the default settings I believe. IIS is running under Local System. In IIS the DefaultAppPool is running under Network Service. Annonymous access uses the account IUSR_JASMINE (machine name is Jasmine).
8
16288
by: William LaMartin | last post by:
I just received my Visual Studio upgrade to 2005 and tried to create a new web site via File | New Web Site with location http. Unfortunately I received the following error: "Visual Web Developer does not support creating Web sites on a SharePoint Web server" If I create a new server extensions 2002 web in IIS and mark it as an application and try to use it from Visual Studio I receive the same error.
3
1676
by: tshad | last post by:
oThumbnail.Save is giving me an error: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. theFileName = New FileInfo(strFileName) fileOut = fileIn.Substring(0,fileIn.LastIndexOf(".")) & session("User").CompanyID & fileIn.Substring(fileIn.LastIndexOf(".")) pathFileOut = Server.MapPath("\Uploads") & "\" & fileIn.Substring(0,fileIn.LastIndexOf(".")) & "Temp" &
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.