Ask a Question related to ASP.NET General, Design and Development.
-
Andreas Semmelmann #1
Type 'ConnectionOptions' is not defined
Hello.
I´ve following Problem. I try to use WMI in an ASP.NET Site. But I get still
this error:
Server Error in '/ServerMon' Application.
----------------------------------------------------------------------------
----
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'ConnectionOptions' is not defined.
Source Error:
Line 1: Dim Options As New ConnectionOptions()
Source File: D:\Inetpub\wwwroot\ServerMon\Default.aspx Line: 1
How must i define the Connection Options. I´ve declared it! See below. I´m
new to ASP.NET/VB.NET.
I used the following Code:
<%@ Page Language="VB" %>
<%@ Import Namespace=System.Diagnostics %>
<script runat="server">
Sub Page_Load(Sender as Object, e as EventArgs)
Dim Options As New ConnectionOptions()
options.Username = "dom\user"
options.Password = "password"
Dim Scope As New ManagementScope("\\mcntr2\root\cimv2", options)
Dim strSVCquery As String =
ConfigurationSettings.AppSettings("NICquery")
Dim objNICQuery As New wqlObjectQuery(strSVCquery)
Dim objNICsearcher As New ManagementObjectSearcher(scope, objNICQuery)
Dim envVar As New ManagementObject()
Dim objNICItem As PropertyData
Dim strNICColName As String
scope.connect
For Each envVar in objNICSearcher.Get
For Each objNICItem in envVar.Properties
strNICColName = objNICItem.Name
Next
Next
End Sub
--
Semmelmann Andreas
Krones AG
mailto:semmelmann.andreas@NOSPAMkrones.de
Andreas Semmelmann Guest
-
Using User Defined Data Type Across
hi! i have created a document class. I have a .net client application and a web service. Both of them using same object model and referencing a... -
index on user defined type
I think I created a type that was compatible with the btree index, and everything seems fine, except that it doesn't actually use the index. I... -
Type 'DataGridPageChangedEventArgs' is not defined
In my code-behind page I have this routine. What do I have to do for it to recognize DataGridPageChangedEventArgs? Sub PageIndexChanged(ByVal... -
BC30002: Type 'DataRowView' is not defined.
Hi I get this error when I try to run my Page which has nested DataGrid. <asp:DataGrid id=DataGrid2 runat="server" AutoGenerateColumns="False"... -
type AssemblyTitle is not defined
Hi, You are missing an Import to System.Reflaction or reference (not import) to System.Reflaction.Dll. In .Net you must to reference the... -
Natty Gur #2
Re: Type 'ConnectionOptions' is not defined
Hi,
you probebly missing reference to System.Management.dll assembly.
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Andreas Semmelmann #3
Re: Type 'ConnectionOptions' is not defined
Hi Natty
I´ve imported the System.Managment. I´ve used the following code:
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Management" %>
<script runat="server">
Sub Page_Load(obj as object, e as eventargs)
On Error Resume Next
'This script uses Windows Management Instrumentation (WMI)
'to return a list of properties for the a specified drive
'attached to the server.
Dim sDriveLetter As String
Dim DiskProperties As PropertyDataCollection
Dim DiskProperty
'Drive letter for which to show drive properties
sDriveLetter = "C:"
Dim disk As New ManagementObject("win32_logicaldisk.deviceid=""" &
_
sDriveLetter & """")
disk.Get()
Response.write("<H2>Properties of Drive " & sDriveLetter & "</H2>")
'Retrieve the disk's properties
DiskProperties = disk.Properties
'Iterate through the disk's properties
For Each DiskProperty In DiskProperties
'Check whether the particular property is defined for this
drive
If IsDBNull(DiskProperty.Value.ToString()) Then
Response.Write("<FONT COLOR=""blue"">" & DiskProperty.Name &
_
"</FONT> = <not defined><BR>")
Else
Response.Write("<FONT COLOR=""blue"">" & DiskProperty.Name &
_
"</FONT> = <FONT COLOR=""red"">" & _
DiskProperty.Value.ToString() & "</FONT><BR>")
End If
Next
disk = nothing
End Sub
"Natty Gur" <natty@dao2com.com> schrieb im Newsbeitrag
news:urs7MiBYDHA.2152@TK2MSFTNGP09.phx.gbl...> Hi,
>
> you probebly missing reference to System.Management.dll assembly.
>
> Natty Gur, CTO
> Dao2Com Ltd.
> 34th Elkalay st. Raanana
> Israel , 43000
> Phone Numbers:
> Office: +972-(0)9-7740261
> Fax: +972-(0)9-7740261
> Mobile: +972-(0)58-888377
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Andreas Semmelmann Guest
-
Natty Gur #4
Re: Type 'ConnectionOptions' is not defined
Hi,
You import the System.Managment but that’s no enough. Imports simply let
you access class without full name (using namespace). To enable ASP.NET
to know type a reference to the assembly that holds that type is
necessary. Add reference by using "Add reference" sub menu under
"project" menu.
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Andreas Semmelmann #5
Re: Type 'ConnectionOptions' is not defined
Hi.
Are these settings for Visual Studio .NET? I think so. Do you know the
aproppriate setting for ASP.NET Web Matrix?
As I told you in a former posting, I´m very new to .NET programming. You
must talk to me like I was a fool! Thanks a lot.
"Natty Gur" <natty@dao2com.com> schrieb im Newsbeitrag
news:%23hJnHcJYDHA.384@TK2MSFTNGP12.phx.gbl...> Hi,
>
> You import the System.Managment but that's no enough. Imports simply let
> you access class without full name (using namespace). To enable ASP.NET
> to know type a reference to the assembly that holds that type is
> necessary. Add reference by using "Add reference" sub menu under
> "project" menu.
>
> Natty Gur, CTO
> Dao2Com Ltd.
> 34th Elkalay st. Raanana
> Israel , 43000
> Phone Numbers:
> Office: +972-(0)9-7740261
> Fax: +972-(0)9-7740261
> Mobile: +972-(0)58-888377
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Andreas Semmelmann Guest



Reply With Quote

