|
When it comes to the instalutil.exe - are you sure you opened the Command Prompt with path's set to the VS folders? Open the Command Prompt using the shortcut in the Visual Studio Tools in the start menu.
Start Menu >> Microsoft Visual Studio 2XXX >> Visual Studio Tools >> Visual Studio 2XXX Command Prompt
|
|
|
|
|
Hi, I have a class that triggers two different events.
- EventA triggers an event with argument AEventArgs
- EventB triggers an event with argument BEventArgs
Code sample below.
My question is:
How can I create one generic function TriggerEvent(...) that replaces TriggerEventA(...) and TriggerEventB(...) ?
class Publisher
{
public event EventHandler<AEventArgs> EventA;
public event EventHandler<BEventArgs> EventB;
public void TriggerEvents()
{
TriggerEventA(EventA, new AEventArgs());
TriggerEventB(EventB, new BEventArgs());
}
private void TriggerEventA(EventHandler<AEventArgs> eventHandler, AEventArgs args)
{
EventHandler<AEventArgs> handler = eventHandler;
if (handler != null)
{
handler(this, args);
}
}
private void TriggerEventB(EventHandler<BEventArgs> eventHandler, BEventArgs args)
{
EventHandler<BEventArgs> handler = eventHandler;
if (handler != null)
{
handler(this, args);
}
}
}
class AEventArgs : EventArgs
{
}
class BEventArgs : EventArgs
{
}
|
|
|
|
|
How about,
class Publisher
{
public event EventHandler<AEventArgs> EventA;
public event EventHandler<BEventArgs> EventB;
public void TriggerEvents()
{
TriggerEvent(EventA, new AEventArgs());
TriggerEvent(EventB, new BEventArgs());
}
private void TriggerEvent<TEventArgs>(EventHandler<TEventArgs> eventHandler, TEventArgs args)
where TEventArgs : EventArgs
{
EventHandler<TEventArgs> handler = eventHandler;
if (handler != null)
{
handler(this, args);
}
}
} You call it like TriggerEvent<AEventArgs>(EventA, new AEventArgs()) or without specifying the generic type. If type is not specified, compiler will infer from the type of parameter passed.
|
|
|
|
|
Thanks a lot!
|
|
|
|
|
No, can't figure this out by myself...
I do have some dll's written in c++ which are part of a big project. Now I want to do a C# program that only display functions and parameters from a selected dll dynamically.
Tried some with LoadLibrary but can't get it to work. I won't call the dll code just need the info. Ideas?
|
|
|
|
|
For managed C++/CLI code, you could use reflection.
For native C/C++ code, the only way I see is by diving into the DLL file yourself, locating the EXPORTS table and mimicking the DUMPBIN utility (with option /EXPORT).
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi,
How can i validate in .Net C# a SAML signature created in Java? Here is the SAML Signature that i get from Java:
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
</ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1">
</ds:SignatureMethod>
<ds:Reference URI="#_e8bcba9d1c76d128938bddd5ae8c68e1">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature">
</ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="code ds kind rw saml samlp typens #default xsd xsi">
</ec:InclusiveNamespaces>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
</ds:DigestMethod>
<ds:DigestValue>zEL7mB0Wkl+LtjMViO1imbucXiE=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
jpIX3WbX9SCFnqrpDyLj4TeJN5DGIvlEH+o/mb9M01VGdgFRLtfHqIm16BloApUPg2dDafmc9DwL
Pyvs3TJ/hi0Q8f0ucaKdIuw+gBGxWFMcj/U68ZuLiv7U+Qe7i4ZA33rWPorkE82yfMacGf6ropPt
v73mC0bpBP1ubo5qbM4=
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
MIIDBDCCAeygAwIBAgIIC/ktBs1lgYcwDQYJKoZIhvcNAQEFBQAwNzERMA8GA1UEAwwIQWRtaW5D
QTExFTATBgNVBAoMDEVKQkNBIFNhbXBsZTELMAkGA1UEBhMCU0UwHhcNMDkwMjIzMTAwMzEzWhcN
MTgxMDE1MDkyNTQyWjBaMRQwEgYDVQQDDAsxMC41NS40MC42MTEbMBkGA1UECwwST24gRGVtYW5k
IFBsYXRmb3JtMRIwEAYDVQQLDAlPbiBEZW1hbmQxETAPBgNVBAsMCFNvZnR3YXJlMIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQCk5EqiedxA6WEE9N2vegSCqleFpXMfGplkrcPOdXTRLLOuRgQJ
LEsOaqspDFoqk7yJgr7kaQROjB9OicSH7Hhsu7HbdD6N3ntwQYoeNZ8nvLSSx4jz21zvswxAqw1p
DoGl3J6hks5owL4eYs2yRHvqgqXyZoxCccYwc4fYzMi42wIDAQABo3UwczAdBgNVHQ4EFgQUkrpk
yryZToKXOXuiU2hNsKXLbyIwDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBSiviFUK7DUsjvByMfK
g+pm4b2s7DAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQEF
BQADggEBAKb94tnK2obEyvw8ZJ87u7gvkMxIezpBi/SqXTEBK1by0NHs8VJmdDN9+aOvC5np4fOL
fFcRH++n6fvemEGgIkK3pOmNL5WiPpbWxrx55Yqwnr6eLsbdATALE4cgyZWHl/E0uVO2Ixlqeygw
XTfg450cCWj4yfPTVZ73raKaDTWZK/Tnt7+ulm8xN+YWUIIbtW3KBQbGomqOzpftALyIKLVtBq7L
J0hgsKGHNUnssWj5dt3bYrHgzaWLlpW3ikdRd67Nf0c1zOEgKHNEozrtRKiLLy+3bIiFk0CHImac
1zeqLlhjrG3OmIsIjxc1Vbc0+E+z6Unco474oSGf+D1DO+Y=
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
If someone knows please help!!
Thank you very much.
|
|
|
|
|
|
I know to parse SAML, i need to validate the signature.
I tried this:
public bool VerifySignature()
{
X509Certificate2 certificate = null;
XmlDocument doc = new XmlDocument();
XmlElement xmlAssertionElement = this.GetXml(doc);
doc.AppendChild(xmlAssertionElement);
SamlSignedXml signedXml = new SamlSignedXml(xmlAssertionElement);
XmlElement xmlSignature = this.Signature;
if (xmlSignature == null)
{
return false;
}
signedXml.LoadXml(xmlSignature);
foreach (KeyInfoClause clause in signedXml.KeyInfo)
{
if (clause is KeyInfoX509Data)
{
if (((KeyInfoX509Data)clause).Certificates.Count > 0)
{
certificate = (X509Certificate2)((KeyInfoX509Data)clause).Certificates[0];
}
}
}
if (certificate == null)
{
return false;
}
return signedXml.CheckSignature(certificate, true);
}
It valides the signature of a SAML signed in .Net but not of this Java one.
|
|
|
|
|
|
How can I get the local machine's IP address in a Windows app ?
|
|
|
|
|
|
Did you even try Google before posting this..?
|
|
|
|
|
System.Net.IPAddress[] MyIPs = System.Net.Dns.GetHostAddresses(Environment.MachineName);
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Hi,
All previous replies lead to your local IP address, i.e. the address as seen on your LAN; when connecting to the Internet, the outside world may see you at a different address though, and you need an external server to tell you that address, have a look here[^].
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
//
//IP
//
System.Net.IPAddress[] addressList = Dns.GetHostByName (Dns.GetHostName()).AddressList;
for (int i = 0; i < addressList.Length; i ++)
{
s += addressList[i].ToString();
}
modified 27-May-14 5:31am.
|
|
|
|
|
Hi guys
So the past few weeks I've been doing research and playing around with TCP servers. I've finally got the one type of server architecture down and I understand the why's and the how's.
Basically the server object creates a TcpListener in its own thread to listen for client connections. When this listener thread accepts a client it creates a client object for it and handles communication(which is the blocking type) for that client in its own thread. So 1 thread per client.
I get that this doesn't scale well and why.
Now I need to move on to the non blocking way. I believe its called "asynchronous TCP sockets", using BeginConnect() , BeginAccept() , BeginSend() , BeginReceive() , EndConnect() , EndAccept() , EndSend() and EndReceive()
Now I've found alot of articles but what I really need is a bare bones example and explanation. Alot of these articles are built around custom libraries and implementations of this server architecture and I find it difficult to find the core concepts in between other code.
So my question, can anyone recommend an article where this is explained well enough and in a bare bones type manor? I'm really more interested in how it works instead of copying the code and modifying it for my needs.
Thanks
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Harvey Saayman wrote: Basically the server object creates a TcpListener in its own thread to listen for client connections
When creating scalable server applications, you should work directly with Socket class. If you need more, come up with a custom socket implementation which suits your needs. We did this once with an application. TcpListener or TcpClient are just wrapper classes built on top of Socket class. You will find it very limiting when you start coding with these classes.
Here[^] is my favorite article. I never found another one which is not even closer to this.
If you are doing serious coding, I would suggest to take a book rather than depending on several articles.
|
|
|
|
|
Hey Navaneeth
That looks promising thank you very much
<NoteToOthers>
If you know of other useful articles please let me know
</NoteToOthers>
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
hi all,
i hav a css class which i hav applied to 4 elements. i want to change the width property od the css class alone in code behind.
how do i do it?
thanks in advance
|
|
|
|
|
there is no way to change a single attribute in a css class in code behind.
how u can do it is either giv another css class or set a particular style attribute in code behind
|
|
|
|
|
// asp.net
<td class="UI" ...>
//css
.UI
{
。。。
。。。
width:100%; /* width:50px*/
。。。
。。。
}
modified 27-May-14 5:31am.
|
|
|
|
|
i have created a dynamic 2d array using list<list <double="">> ....
now i want to convert this object into an actual array ?
how can i do that ?
bcoz the list.toarray can (i think convert it into a 1d array)???
|
|
|
|
|
Couple of things:
1) When you try to describe things such as List<T> please use the greater than and less than symbols just above - that way they don't get stripped out as HTML.
2) We would need more information. I am guessing that your "dynamic 2D array using list>" is actually along the lines of "List<List<string>>" but it could be anything really. We need to know what you are doing in order to help.
3) Check your post with the "Preview" button to ensure it looks like what you wrote! I keep forgetting...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
hi,
is there any site from where developer can acquire Domain knowledge for developing accounting software or CRM or various module of ERP. i search google but didn't find any such site so if anyone knows then please give me the reference of those site.
Thanks
tbhattacharjee
|
|
|
|