C
Clas Hortien
Hello,
i try to get access to a local virtual server object.
I have a aspx page with a button and textbox, this is the code:
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnFillBox;
protected System.Web.UI.WebControls.TextBox txtHost;
protected System.Web.UI.WebControls.Label Label1;
public enum RpcAuthnLevel
{
Default = 0,
None = 1,
Connect = 2,
Call = 3,
Pkt = 4,
PktIntegrity = 5,
PktPrivacy = 6
}
public enum RpcImpLevel
{
Default = 0,
Anonymous = 1,
Identify = 2,
Impersonate = 3,
Delegate = 4
}
public enum EoAuthnCap
{
None = 0x00,
MutualAuth = 0x01,
StaticCloaking= 0x20,
DynamicCloaking= 0x40,
AnyAuthority= 0x80,
MakeFullSIC= 0x100,
Default= 0x800,
SecureRefs= 0x02,
AccessControl= 0x04,
AppID= 0x08,
Dynamic= 0x10,
RequireFullSIC= 0x200,
AutoImpersonate= 0x400,
NoCustomMarshal= 0x2000,
DisableAAA= 0x1000
}
[DllImport("ole32.dll")]
public static extern int CoInitializeSecurity( IntPtr pVoid, int
cAuthSvc,IntPtr asAuthSvc, IntPtr pReserved1, RpcAuthnLevel level,
RpcImpLevel impers,IntPtr pAuthList, int dwCapabilities, IntPtr
pReserved3 );
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnFillBox.Click += new System.EventHandler
(this.btnFillBox_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
[STAThread]
private void btnFillBox_Click(object sender, System.EventArgs e)
{
this.txtHost.Text = "";
CoInitializeSecurity( IntPtr.Zero, -1, IntPtr.Zero,
IntPtr.Zero,RpcAuthnLevel.PktIntegrity ,
RpcImpLevel.Identify,IntPtr.Zero, 0x40, IntPtr.Zero );
VMVirtualServerClass vs;
vs = new VMVirtualServerClass();
this.txtHost.Text = vs.Version;
}
}
}
I always get a "Access denied" on vs = new VMVirtualServerClass();
I have tried different combinations for CoInitializeSecurity, but with no
success.
Does anybody has experience of accessing a Virtual Server (COM) through
ASP.NET ? Or is there another usable interface to VS ?
Many thanks
Clas
i try to get access to a local virtual server object.
I have a aspx page with a button and textbox, this is the code:
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnFillBox;
protected System.Web.UI.WebControls.TextBox txtHost;
protected System.Web.UI.WebControls.Label Label1;
public enum RpcAuthnLevel
{
Default = 0,
None = 1,
Connect = 2,
Call = 3,
Pkt = 4,
PktIntegrity = 5,
PktPrivacy = 6
}
public enum RpcImpLevel
{
Default = 0,
Anonymous = 1,
Identify = 2,
Impersonate = 3,
Delegate = 4
}
public enum EoAuthnCap
{
None = 0x00,
MutualAuth = 0x01,
StaticCloaking= 0x20,
DynamicCloaking= 0x40,
AnyAuthority= 0x80,
MakeFullSIC= 0x100,
Default= 0x800,
SecureRefs= 0x02,
AccessControl= 0x04,
AppID= 0x08,
Dynamic= 0x10,
RequireFullSIC= 0x200,
AutoImpersonate= 0x400,
NoCustomMarshal= 0x2000,
DisableAAA= 0x1000
}
[DllImport("ole32.dll")]
public static extern int CoInitializeSecurity( IntPtr pVoid, int
cAuthSvc,IntPtr asAuthSvc, IntPtr pReserved1, RpcAuthnLevel level,
RpcImpLevel impers,IntPtr pAuthList, int dwCapabilities, IntPtr
pReserved3 );
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnFillBox.Click += new System.EventHandler
(this.btnFillBox_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
[STAThread]
private void btnFillBox_Click(object sender, System.EventArgs e)
{
this.txtHost.Text = "";
CoInitializeSecurity( IntPtr.Zero, -1, IntPtr.Zero,
IntPtr.Zero,RpcAuthnLevel.PktIntegrity ,
RpcImpLevel.Identify,IntPtr.Zero, 0x40, IntPtr.Zero );
VMVirtualServerClass vs;
vs = new VMVirtualServerClass();
this.txtHost.Text = vs.Version;
}
}
}
I always get a "Access denied" on vs = new VMVirtualServerClass();
I have tried different combinations for CoInitializeSecurity, but with no
success.
Does anybody has experience of accessing a Virtual Server (COM) through
ASP.NET ? Or is there another usable interface to VS ?
Many thanks
Clas