Create a virtual directory (application pool in vb.net)

Cancelado Publicado Sep 14, 2006 Pagado a la entrega
Cancelado Pagado a la entrega

I use windows 2003 standard with IIS 6.0.

I have this source code down here to create a virtual directory with application pool on a folder. But it only works on development server in visual studio 2005. It doesn't work on IIS 5.1 or 6.0. Give me some permission error. Here's the description following

Here's link to my ftp server for my source codes. <[url removed, login to view]>

## Deliverables

**[url removed, login to view]**

<% Page Language="VB" AutoEventWireup="false" CodeFile="[url removed, login to view]" Inherits="_Default" Debug="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url removed, login to view]">

<html xmlns="[url removed, login to view]" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

</div>

</form>

</body>

</html>

**[url removed, login to view]**

Imports [url removed, login to view]

Imports System

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Imports [url removed, login to view]

Partial Class _Default

Inherits [url removed, login to view]

Protected Sub Page_Load(ByVal sender As [url removed, login to view], ByVal e As [url removed, login to view]) Handles [url removed, login to view]

If Not IsPostBack Then

CreateVirtualDir("localhost", "test", "e:\test")

End If

End Sub

Private Sub CreateVirtualDir(ByVal WebSite As String, ByVal AppName As String, ByVal Path As String)

'Dim IISSchema As New [url removed, login to view]("IIS://" & WebSite & "/Schema/AppIsolated")

Dim IISSchema As New [url removed, login to view]("IIS://" & WebSite & "/Schema/AppIsolated", "Administrator", "1212")

Dim CanCreate As Boolean = Not [url removed, login to view]("Syntax").[url removed, login to view]() = "BOOLEAN"

[url removed, login to view]()

If CanCreate Then

Dim PathCreated As Boolean

Try

Dim IISAdmin As New [url removed, login to view]("IIS://" & WebSite & "/W3SVC/1/Root")

'make sure folder exists

If Not [url removed, login to view](Path) Then

[url removed, login to view](Path)

PathCreated = True

End If

'If the virtual directory already exists then delete it

For Each VD As [url removed, login to view] In [url removed, login to view]

If [url removed, login to view] = AppName Then

[url removed, login to view]("Delete", New String() {[url removed, login to view], AppName})

[url removed, login to view]()

Exit For

End If

Next VD

'Create and setup new virtual directory

Dim VDir As [url removed, login to view] = [url removed, login to view](AppName, "IIsWebVirtualDir")

[url removed, login to view]("Path").Item(0) = Path

[url removed, login to view]("AppFriendlyName").Item(0) = AppName

[url removed, login to view]("EnableDirBrowsing").Item(0) = False

[url removed, login to view]("AccessRead").Item(0) = True

[url removed, login to view]("AccessExecute").Item(0) = True

[url removed, login to view]("AccessWrite").Item(0) = False

[url removed, login to view]("AccessScript").Item(0) = True

[url removed, login to view]("AuthNTLM").Item(0) = True

[url removed, login to view]("EnableDefaultDoc").Item(0) = True

[url removed, login to view]("DefaultDoc").Item(0) = "[url removed, login to view],[url removed, login to view],[url removed, login to view]"

[url removed, login to view]("AspEnableParentPaths").Item(0) = True

[url removed, login to view]()

'the following are acceptable params

'INPROC = 0

'OUTPROC = 1

'POOLED = 2

[url removed, login to view]("AppCreate", 1)

Catch Ex As Exception

If PathCreated Then

[url removed, login to view](Path)

End If

Throw Ex

End Try

End If

End Sub

End Class

**Error on <http://localhost/[url removed, login to view]>**

Access denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

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.UnauthorizedAccessException.

**Source Error:**

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

**Stack Trace:**

[UnauthorizedAccessException: Access denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]

[url removed, login to view](String WebSite, String AppName, String Path) +1238

_Default.Page_Load(Object sender, EventArgs e) +43

[url removed, login to view](EventArgs e) +99

[url removed, login to view]() +47

[url removed, login to view](Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

## Platform

windows 2003 standard sp 1 with visual studio 2005 and sql 2005.

IIs 6

.NET ASP SO Chrome Ingeniería Linux SO Mac MySQL PHP Arquitectura de software Verificación de software UNIX Windows Desktop

Nº del proyecto: #3797672

Sobre el proyecto

Proyecto remoto Activo Sep 15, 2006