Professional Web Applications Themes

Type 'ConnectionOptions' is not defined - ASP.NET General

Hello. Ive 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. Ive declared it! See below. Im new to ASP.NET/VB.NET. I used the following Code: ...

  1. #1

    Default Type 'ConnectionOptions' is not defined

    Hello.

    Ive 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. Ive declared it! See below. Im
    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.andreasNOSPAMkrones.de


    Andreas Semmelmann Guest

  2. #2

    Default 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

  3. #3

    Default Re: Type 'ConnectionOptions' is not defined

    Hi Natty

    Ive imported the System.Managment. Ive 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> = &lt;not defined&gt;<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" <nattydao2com.com> schrieb im Newsbeitrag
    news:urs7MiBYDHA.2152TK2MSFTNGP09.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

  4. #4

    Default Re: Type 'ConnectionOptions' is not defined

    Hi,

    You import the System.Managment but thats 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

  5. #5

    Default 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, Im very new to .NET programming. You
    must talk to me like I was a fool! Thanks a lot.


    "Natty Gur" <nattydao2com.com> schrieb im Newsbeitrag
    news:%23hJnHcJYDHA.384TK2MSFTNGP12.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

Similar Threads

  1. Using User Defined Data Type Across
    By Serkan DIRIARIN in forum ASP.NET Web Services
    Replies: 1
    Last Post: June 24th, 07:25 AM
  2. index on user defined type
    By Jeff Davis in forum PostgreSQL / PGSQL
    Replies: 6
    Last Post: January 14th, 01:19 AM
  3. Type 'DataGridPageChangedEventArgs' is not defined
    By William Gower in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: April 24th, 06:31 AM
  4. BC30002: Type 'DataRowView' is not defined.
    By Niks in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: April 14th, 02:33 PM
  5. type AssemblyTitle is not defined
    By Natty Gur in forum ASP.NET General
    Replies: 1
    Last Post: July 13th, 01:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139