z
 
:: Home     :: MS Dynamics CRM     :: .Net 1.1     :: .Net 2.0     :: Sharepoint Portal     :: Ajax

  login:        
  passwords:  

Asp.Net FAQs

Asp.NET 2.0 Qs

Knowledgebase

Interview Questions Asp.net [1]
Interview Questions Asp.net[2]
Interview Questions Asp.net[3]
Interview Questions Asp.Net 2.0[New]
Creating Virtual Directories in IIS using .NET
ASP.NET Web Server Performance Tuning: A Few Real-World Techniques
.NET Development[Forum]
Asp.Net Discussion[Forum]
Code Samples

Articles

Tools

 

Resources

Finding Correct Content Managemet System
This list covers the full lifecycle of a content management system, from initially creating the content, through to delivering it to end users...

Workflow Managemet Systems
Workflow management is a crucial component in organizing a variety of business processes so that they benefit the business as a whole and increase profitability...

Using the Power of Content Management Systems
With page editors that resemble a word processor program, adding content with a CMS interface is simple and fun. Most CMS software also allows you to change the location of your content pages and links easily, while the back end processes takes care of updating the links throughout your site...

Content Management Systems (CMS): What They Are And Why We Love Them
In the past, individuals who took interest in having and operating their own websites were burdened with the task of learning HTML, DHTML, and other web-based technologies such as JavaScript and CSS. The only alternative to this was, unfortunately, to pocket the expenses and costs required to pay a web developer to build and maintain it for them...

Outsourcing
Post your project for outsourcing and get bids from qualified programmers, designers, interpreters, copywriters.


 

Code Walkthroughs

Datagrid Formatting the Data
We are able to format the content of the datagrid cell by one of two simple methods, dependant upon whether the column is a bound column or whether it is a template column. In our example we shall format the column to have to digits after the decimal point , followed by a...

Datagrid Highlight a Row With Click Through
It is relatively easy to add alternating colours to the rows in your datagrid. However, when we move the mouse over the rows we may want to highlight this row, and possibly to add the option of a click through based on the row selected...

Add a Delete Button to a Datagrid
To add a delete button to a datagrid follows a similar process to adding an edit button. In the datagrid header...

Add an Edit Button to a Datagrid
The datagrid has a predefined editColumn for handling the editing of a datagrid. Adding this simple column definition to a datagrid adds a powerful feature. When a row is not in edit mode the column item shows the word...

Making a Datagrid Row Editable
Two of the most popular methods of editing a datagrid in asp.net are to either select the row and take the user off to a different presentation of the data, or to change the formatting of the row presented in the database with appropriate edit text boxes, checkboxes and...

Adding Tooltips to Datagrid Rows
Adding tooltips to datagrid rows is easy, assuming that you have already created the code for adding row highlighting. In this article I shall assume that you have already read the article entitled Datagrid Highlight a Row With Click Through...

Binding a Datagrid to an Access Database
This list covers the full lifecycle of a content management system, from initially creating the content, through to delivering it to end users...

Adding Data to a DropDownList
The aim of this article is to answer the question 'How do I add items to a DropDownList?' Initially as part of the declaration for the DropDownList we can also define a number of items, much in the same way as in classic ASP...

Getting Current Date Time
In classic ASP we had now() which would return the current date and time. For asp.net this no longer exists. So what should we use...

Test if File Exists
Sometimes, in order to reduce our chance of error, when working with the filesystem in ASP.NET, we need to determine wether a file exists before performing an action on it. The following short piece of code will enable us to test whether a file exists...

Using Javascript with ASP.NET Form Elements
Adding simple pieces of Javascript to an Asp.net page can be acheived by adding to the attributes of the particular imagebutton or linkbutton. if its normal ASP.Net Button then you can...

Regular Expressions
In the table below we list the characters used in .Net regular expressions, together with their meaning, But first...

Authentication in Asp.net
Forms authentication in ASP.Net is far more easier and safe than Asp 3. It is possible to place a web.config file in any directory of a web site.Therefore, we are able to make most of a web site public, whilst providing authentication on, say, one directory...

Discussion Forums

General ASP.NET

.Net Programming

cSharp Home

Sql Server Home

Javascript / Client Side Development

IT Jobs

Ajax Programming

Ruby on Rails Development

Perl Programming

C Programming Language

C++ Programming

Python Programming Language

Laptop Suggestions?

TCL Scripting

Fortran Programming

Scheme Programming

Creating Virtual Directories in IIS using .NET

You can create virtual directories in IIS using .NET. Sample Vb.net code is pasted below please contact me for any further information to use it.

0001 Imports System
0002 Imports System.DirectoryServices
0003 
0004 
0005 Public Class IISManager
0006     Public Sub IISManager()
0007     End Sub
0008 
0009 
0010     Public Function CreateVDir(ByVal NewsiteName As StringByVal Path As StringByVal chkRead As BooleanByVal chkWrite As BooleanByVal chkExecute As BooleanByVal chkScript As BooleanByVal chkAuth As BooleanByVal serverName As StringByVal DefaultDoc As StringByVal dirList() As StringAs Boolean
0011 
0012         Dim sRet As String = String.Empty
0013         Dim IISSchema As System.DirectoryServices.DirectoryEntry
0014         Dim IISAdmin As System.DirectoryServices.DirectoryEntry
0015         Dim VDir As System.DirectoryServices.DirectoryEntry
0016         Dim IISUnderNT As Boolean
0017 
0018 
0019         ' Determine version of IIS
0020         IISSchema = New System.DirectoryServices.DirectoryEntry("IIS://" + serverName + "/Schema/AppIsolated")
0021         If (IISSchema.Properties("Syntax").Value.ToString().ToUpper() = "BOOLEAN"Then
0022             IISUnderNT = True
0023         Else
0024             IISUnderNT = False
0025         End If
0026 
0027 
0028         IISSchema.Dispose()
0029 
0030 
0031         'Get a Free SiteID
0032         Dim root As DirectoryEntry = New DirectoryEntry("IIS://" & serverName & "/W3SVC")
0033 
0034 
0035         Dim siteID As Integer = 1
0036 
0037 
0038         For Each e As DirectoryEntry In root.Children
0039             If e.SchemaClassName = "IIsWebServer" Then
0040                 Dim ID As Integer = Convert.ToInt32(e.Name)
0041                 If (ID >= siteID) Then
0042                     siteID = ID + 1
0043                 End If
0044             End If
0045         Next
0046 
0047 
0048         ''''''''''''''''Dim site = root.Invoke("Create","IIsWebServer", siteID)
0049         ''''''''''''''''site.Invoke("Put", "ServerComment",NewsiteName)
0050 
0051 
0052         ''''''''''''''''site.Invoke("Put", "KeyType", "IIsWebServer")
0053         ''''''''''''''''site.Invoke("Put", "ServerBindings", ":80:")
0054         ''''''''''''''''site.Invoke("Put", "ServerState", 2)
0055         ''''''''''''''''site.Invoke("Put", "FrontPageWeb", 1)
0056         ''''''''''''''''site.Invoke("Put", "DefaultDoc", DefaultDoc)
0057         '''''''''''''''''site.Invoke("Put", "SecureBindings", ":443:")
0058         ''''''''''''''''site.Invoke("Put", "ServerAutoStart", 1)
0059         ''''''''''''''''site.Invoke("Put", "ServerSize", 1)
0060         ''''''''''''''''site.Invoke("SetInfo")
0061 
0062 
0063         ''''''''''''''''site.CommitChanges()
0064 
0065 
0066         siteID = 312010922
0067 
0068 
0069         '
0070         ' Get the admin object
0071         '
0072         IISAdmin = New System.DirectoryServices.DirectoryEntry("IIS://" + serverName + "/W3SVC/" + siteID.ToString() + "/Root")
0073 
0074 
0075         '
0076         ' If the virtual directory already exists then delete it
0077         '
0078         For Each v As System.DirectoryServices.DirectoryEntry In IISAdmin.Children()
0079             ' Delete the specified virtual directory if it already
0080             exists()
0081             Try
0082                 IISAdmin.Invoke("Delete"New String() {v.SchemaClassName, v.Name})
0083                 IISAdmin.CommitChanges()
0084             Catch ex As Exception
0085             End Try
0086         Next
0087 
0088 
0089         '
0090         ' Create the virtual directory
0091         '
0092         Dim ii As Integer = 0
0093 
0094 
0095         For ii = 0 To dirList.Length - 1
0096             Dim dirName = dirList(ii).Split("")(dirList(ii).Split("").Length - 1).ToUpper()
0097             If Not (dirName.toupper() = "BIN" Or dirName.toupper() = "BLL"Then
0098                 Try
0099                     VDir = IISAdmin.Children.Add(dirName, "IIsWebVirtualDir")
0100                     '
0101                     ' Setup the VDir
0102                     '
0103                     VDir.Properties("AccessRead")(0) = chkRead
0104                     VDir.Properties("AccessExecute")(0) = chkExecute
0105                     VDir.Properties("AccessWrite")(0) = chkWrite
0106                     VDir.Properties("AccessScript")(0) = chkScript
0107                     VDir.Properties("AuthNTLM")(0) = chkAuth
0108                     VDir.Properties("EnableDefaultDoc")(0) = True
0109                     VDir.Properties("EnableDirBrowsing")(0) = False
0110                     VDir.Properties("DefaultDoc")(0) = True
0111                     VDir.Properties("Path")(0) = Path
0112 
0113 
0114                     ' NT doesn't support this property
0115                     '
0116                     If (IISUnderNT = FalseThen
0117                         VDir.Properties("AspEnableParentPaths")(0) = True
0118                     End If
0119 
0120 
0121                     '
0122                     ' Set the changes
0123                     '
0124                     VDir.CommitChanges()
0125                     VDir.Invoke("Put""DefaultDoc", DefaultDoc)
0126                     VDir.Invoke("SetInfo")
0127                     '
0128                     ' Make it a web application
0129                     '
0130                     If (IISUnderNT = TrueThen
0131                         VDir.Invoke("AppCreate"False)
0132                     Else
0133                         VDir.Invoke("AppCreate", 1)
0134                     End If
0135                 Catch ex As Exception
0136 
0137 
0138                 End Try
0139             End If
0140         Next
0141 
0142 
0143         Return True
0144     End Function
0145 
0146 
0147     Public Property ServerName() As String
0148         Get
0149             Return _serverName
0150         End Get
0151         Set(ByVal Value As String)
0152             _serverName = Value
0153         End Set
0154     End Property
0155 
0156 
0157     Public Shared VirDirSchemaName As String = "IIsWebVirtualDir"
0158     Private _serverName As String
0159 
0160 
0161 End Class
 


::  Home :: Services ::  Prices ::  Request Quote
Copyright 2007, Megasolutions Ltd