Skowronek

Posts Tagged ‘Snipits’

Create Multiple Web Sites on XP Version of IIS

AddThis Social Bookmark Button

‘ Create an instance of the virtual directory object
‘ that represents the default Web site.
Set IIsWebVDirRootObj = GetObject(“IIS://localhost/W3SVC/1/Root”)

‘ Use the Windows ADSI container object “Create” method to create
‘ a new virtual directory.
Set IIsWebVDirObj = IIsWebVDirRootObj.Create(“IIsWebVirtualDir”, “NewVDir”)

‘ Use the Windows ADSI object “Put” method to
‘ set some required properties.
IIsWebVDirObj.Put “Path”, “C:\NewContent”
IIsWebVDirObj.Put “AccessRead”, True
IIsWebVDirObj.Put “AccessScript”, True

‘ Use the AppCreate2 method of the IIS ADSI provider to
‘ create an application on the new virtual directory.
IIsWebVDirObj.AppCreate2 1
IIsWebVDirObj.Put “AppFriendlyName”, “NewApp”

‘ Use the Windows ADSI object “SetInfo” method to
‘ save the data to the metabase.
IIsWebVDirObj.SetInfo

Converting .NET DateTime to UNIX Timestamp

AddThis Social Bookmark Button
Note to self:
How to convert .NET DateTime to UNIX timestamp (as in PHP, etc.)
int timestamp = (DateTime.UtcNow – new DateTime(1970,1,1,0,0,0)).TotalSeconds
and convert a Unix timestamp to an ASP.NET DateTime value:
DateTime date = (new DateTime(1970,1,1,0,0,0)).AddSeconds(datestamp)