L
LamSoft
I have the access denied on my ASP.NET C# program while deploy my project from my PC (WinXP) to Server 2003
The program works fine on my PC but get access denied on Server 2003.
However the program works fine on Windows Server 2003 while trying to use WMI to get resource from the itsself computer, just has the problem while remoting to other computer.
I did put the permission of all security to "Everyone" on "Windows Managment and Instrustmentation" in Component Service, or even put the ASP.NET account is as a group of Administrators and no help, did I do anything wrong? Thank you.
Here is the stack trace:
[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
System.Management.ManagementScope.InitializeGuts(Object o) +784
System.Management.ManagementScope.Initialize() +216
System.Management.ManagementScope.Connect() +5
_Default.showUserList(String password, String server) +293
_Default.btnSubmit_Click(Object sender, EventArgs e) +58
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Here is some of the code in "Default.aspx"
Protected Sub showUserList(ByVal password As String, ByVal server As String)
If server = "" Then
MS = New ManagementScope("\\.\root\cimv2")
MS.Connect()
objQuery = New System.Management.ObjectQuery("Select Name from Win32_UserAccount")
Else
conn.Username = "administrator"
conn.Password = password
MS = New ManagementScope("\\" & server & "\root\cimv2", conn)
MS.Connect()
objQuery = New System.Management.ObjectQuery("Select Name from Win32_UserAccount")
End If
.........
End Sub
The program works fine on my PC but get access denied on Server 2003.
However the program works fine on Windows Server 2003 while trying to use WMI to get resource from the itsself computer, just has the problem while remoting to other computer.
I did put the permission of all security to "Everyone" on "Windows Managment and Instrustmentation" in Component Service, or even put the ASP.NET account is as a group of Administrators and no help, did I do anything wrong? Thank you.
Here is the stack trace:
[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
System.Management.ManagementScope.InitializeGuts(Object o) +784
System.Management.ManagementScope.Initialize() +216
System.Management.ManagementScope.Connect() +5
_Default.showUserList(String password, String server) +293
_Default.btnSubmit_Click(Object sender, EventArgs e) +58
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Here is some of the code in "Default.aspx"
Protected Sub showUserList(ByVal password As String, ByVal server As String)
If server = "" Then
MS = New ManagementScope("\\.\root\cimv2")
MS.Connect()
objQuery = New System.Management.ObjectQuery("Select Name from Win32_UserAccount")
Else
conn.Username = "administrator"
conn.Password = password
MS = New ManagementScope("\\" & server & "\root\cimv2", conn)
MS.Connect()
objQuery = New System.Management.ObjectQuery("Select Name from Win32_UserAccount")
End If
.........
End Sub