|
This exception is usually associated with a class that is licensed. See the LicenseProvider , LicenseProviderAttribute , and related classes in the SDK docs for more information. Basically, your class was apparently marked with the LicenseProviderAttribute which referenced the type of a custom LicenseProvider . That license provider verifies that a client can - at either design-time or runtime - use the licensed class. The message you got is the default message used when a class is not licensed (i.e., whatever your license provider checks, your tech writer doesn't have it).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I want to get the label of a local disk, using System.ManagementObject. The code below help me
to get out the name of each disk ("c:\", "d:\", ...), not the label of it.
ManagementObjectCollection queryCollection = getDrives();
foreach ( ManagementObject mo in queryCollection){
Console.WriteLine(mo["Name"].ToString());
}
How to get the label?
Thanks.
|
|
|
|
|
You need to use "win32_logicaldisk" as your ManagementObject and use
"VolumeName" to get the info you need.
Regards,
Kannan
|
|
|
|
|
Use the following WMI property ads illustrated...
Console.WriteLine(mo["VolumeName"].ToString());
|
|
|
|
|
thanks.
But I want to know the full-list of propertyName of it.
VolumeName
Name
DriveType
...
and so?
|
|
|
|
|
Hi
I need some help with some code i making. I´m making an FTP Server, an need to make a Socket were I can be listening for new connections. The problem is, that I can not use a static port number because, there will be many clients, and therefor I need a new port for each client connecting with a passive connection.
In other languages (java) you just make a new ServerSocket() with the portnumber 0, and then you´ll get a ServerSocket running on a new available port every time..
How can I do this in C#.... please help me - a FTP server which can only handle one passive connection at the time is not very efficient..
thx in advance
Søren
|
|
|
|
|
It's almost as easy. Create a new IPEndPoint with the IPAddress to listen on and 0 for the port:
IPEndPoint ip = new IPEndPoint(IPAddress.Loopback, 0); In your case, you won't want to use the loopback for a server that accepts outbound connections, though.
Then, create your Socket and call it's Bind method, passing the IPEndPoint . You could, instead, use a TcpListener , passing the IPEndPoint into the constructor. This is geared more toward TCP servers, which , of course, FTP uses.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you it worked.
Søren Christensen..
|
|
|
|
|
Hi All,
I am building a web application and would like to know if I can request a "Read Receipt" for the mails I send from the application.
Basically my application will send mails to various addresses and I want to request "Read Receipts" to find out if the message was read and on what date.
I know that in asp using CDONTS, we can do something like "Disposition-Notification-To". I am seeking the C# and ASP.NET equivalent or better if possible, without using third-party components.
Thanks in advance.
Raj
|
|
|
|
|
What are you using to generate the mail headers?
It should be possible to add either a "Disposition-Notification-To:" or a "Read-Receipt-To" into that easily enough.
Bear in mind, of course, that some sites have software that filters out one or more of these to stop spam.
Steve S
|
|
|
|
|
My program is watching for a directory on any incoming file and then move it to other places. Another application produce the data file to that directory. The problem is: my program always get the error message:
access violation
So, how can I know from program point of view that the file is accessed by another process? Is there any related API? Thanks in advance.
|
|
|
|
|
For files opened over a share, you can use NetFileEnum . For the local system, there is a function or two in the Win32 API but they are undocumented and unreferenced. There is a program called "handles" available at http://www.sysinternals.com/ntw2k/freeware/handle.shtml[^] that can show you open handles. I have examined this executable for the exports it uses but there are a lot of undocumented functions with somewhat ambiquous names.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
That's because C# (rather, the CLR) doesn't recognize the [optional] automation attribute like VB/VBScript does, and COM doesn't support overloads. If VB doesn't supply these optional parameters, though, defaults are used. These defaults for each parameter are documented so just pass those defaults for the parameters in C#. It'll have the same effect.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi, friends.
I want to ask how can I compose serval bitmaps or images into one image file?
suppose I have 2, 3, or 4 bitmap files, each file has the same contents but different color, now I want to compose them to one new bitmap. Is there any easy method or fast way to do this?
anyone has tried this application, please give me some idea... Thank you
|
|
|
|
|
Read my image processing articles. Ultimately, you probably want to merge the pixel values and build a new bitmap.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok this may or may not be possible and if it's possible then it may be so easy to do that I go and hide under the covers of my bed for asking such a stupid question but here goes.
Is it possible to create Attriobutes at runtime for a method or function. The main reason I want to do this is that I want to create an Attribute class that will work in a similiar way to the Obselete Attribute class. So my first question is - how does the Obsolete attribute work so that during compilation it causes an error if a function that has been created with the Obsolete Attribute and is then called from elsewhere in the code.
Secondly is it possible within the constructor of my attribute class to create an instance of the Obsolete attribute class and for this to then work the same way as if I had placed the Obsolete Attribute before the method/class/variable.
Thirdly can you create an Attribute at run time that you can apply to a method, in a similiar way that you can access what Attributes have been applied to a method.
Please note that where I have used method in this text please replace with Method/Class/Variable etc.
Thanks in advance if anyone has any information on this,
Mark
|
|
|
|
|
Hi Mark. There are some articles on attributes here on CodeProject that you may want to check out (do a search for "attributes"). I particularly liked this one from sadaf alvi
http://www.codeproject.com/csharp/attributes.asp[^]
I haven't tried it, but it seems reasonable that an Attribute could be created at runtime... how would it be applied? I see the GetCustomAttributes method, but nothing to set them...
|
|
|
|
|
Actually, you cannot create attributes at runtime. They represent meta-data, or data that describes data (the compiled code). They are set only by the compiler for the particular source file.
However, there are a couple ways around this. The first it so emit an assembly (see System.Reflection.Emit ) and attribute a emitted class with attributes before compiling the assembly.
The second way is to implement ICustomTypeDescriptor . For the most part, most methods can use the appropriate overloaded TypeDescriptor method that takes a bool dictating whether or not to query for said interface (that way, while you still have to implement every method, you don't have to write any custom code when you don't need to). In your implementation of ICustomTypeDescriptor.GetAttributes , return a custom set of attribute classes.
Implementing ICustomTypeDescriptor is only useful when something uses the TypeDescriptor class (or something else that uses it, like the PropertyGrid component - we the interface to custom some of this stuff in a runtime grid in our app). Of course, a class of yours could query for it, too, but usually the TypeDescriptor is sufficient.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Interesting, Heath. Good info
|
|
|
|
|
Thanks for that Heath, very useful information. At least I can rest assured that I was not being that Stupid when I asked the question...
|
|
|
|
|
the obsolete attrib is hardcoded into the compiler..
and so is the strongname key attribs and everything else that can raise compile errors..
you cannot create your own attribs that does the same..
//Roger
|
|
|
|
|
Hi anybody knows how to get the IP address of my DSL modem passing through
linksys router using .net framework in C# ????
Thanks
|
|
|
|
|
If you're linksys has the latest BIOS update, you could use the UPnP interface to query the external IP address. You'll need to find more information about UPnP in MSDN or download the SDK from the same site. There's far too much to cover on a broad topic here.
Another way - somewhat of a hack - would be to create a new process (see System.Diagnostics.Process ) to start tracert.exe and redirect its stdout. The second hop should be the IP address of your linksys's external interface. This only works if it allows pings out if firewalled.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
I am trying to do the same. As someone suggested me to use a feature in my linksys router but mine doesn't have it. Anyway, there are several ways but I did:
1. Create a simple html page which records(using script php, java, asp..) client IP and display it on the page. This page will be hosted somewhere outside your linksys router. example: http://www.somedomain.com/ip.html which will display string IP=111.112.114.115. Your code will go to that page and grab the text and parse for IP.
and Here is the code in C#
Regex regexp = new Regex("IP=[0-9]+.[0-9]+.[0-9]+.[0-9]+");
WebRequest request = WebRequest.Create("http://www.somedomain.com/ip.html");
WebResponse response = request.GetResponse();
StreamReader rd = new StreamReader(response.GetResponseStream());
string content = rd.ReadToEnd();
string myip = regexp.Match(content).ToString();
then you can split the string and get IP only.
2. The second way is to login your linksys router and go to http://192.168.1.1/status.htm
and then seach for wan IP but I still have problem with the login.
|
|
|
|
|
Thanks a lot for the reply.
I see we are at the same level.
I prefere the second option because i find kind
of useless to read the IP of the wan from outside.
I thought the same as you and I have the problem
for the login too.
I'd like to query the router with a command,
but I don't know how.
I think with a CISCO you can do it like the
old HAYES AT command of the analog modems style.
But with linksys..... ?????
Thanks I will work on the login to the 192.168.1.1 address
|
|
|
|