.net

error sending email in .NET

i am getting an error saying "5.7.1: Unable to relay for [email protected]" any ideas what this means? ...

Serialize a .Net SqlTransaction?

We have an interesting setup where we have SqlTransactions persisted to Application memory on a web application. We're looking into moving our web application into an NLB scenario, so we need a way for those Transactions to not be tied to a single machine's memory. Is there any way we can accomplish this..I've tried serializing a SqlTran...

Wrapper type in .NET: struct or class?

Consider the following scenario: int Caller1<T>(T t) where T : IInterface {...} T Caller2<T>() where T : IInterface {...} class Wrappee // doesn't implement IInterface, but could ??? Wrapper : IInterface { private readonly Wrappee _wrappee; // methods call _wrappee's methods } Now, the general advice for choosing between struct...

Is there a generic (type-safe) BitArray in .NET?

Is there a generic BitArray in .NET? I only found the non-generic one. Can there be a generic BitArray? (i.e. would it be reasonable?) Edit: Maybe I should have said type-safe not generic. Basically when you enumerate the type as object, should it not be int or bool? Or one of them provided in another member enumerator? Example:...

What is the best way to get the current user's SID?

Prerequisite Detail Working in .NET 2.0. The code is in a common library that could be called from ASP.Net, Windows Forms, or a Console application. Running in a Windows Domain on a corporate network. The Question What is the best way to get the current user's SID? I'm not talking about the identity that is executing the applicati...

How to get the length of a MP3 in C#

Yes this is an exact duplicate of this question, but the link given and accepted as answer is not working for me. It is returning incorrect values (a 2 minutes mp3 will be listed as 1'30, 3 minutes as 2'20) with no obvious pattern. So here it is again: how can I get the length of a MP3 using C# ? or What am I doing wrong with the MP3...

Why I get an XmlException "Unexpected end of file" with the TextMessageEncodingBindingElement ?

I try to do something really simple in theory : deserialize a string to a Message, here is the code : [TestMethod] public void EncoderErrorTest() { var message = "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:a=\"http://www.w3.org/2005/08/addressing\"&gt;&lt;s:Header&gt;&lt;a:Action s:mustUnderstand=\"1\">htt...

Children.Add(item) Value does not fall within the expected range

I'm developing a Silverlight 3 App and getting this really weird error when I try to add an object to a Canvas. My code is as follows: for (int i = 0; i < person.Children.Count; i++) { //Add children in same position as parent Person child = person.Children[i]; child.x_PositionTransform.X = pe...

What version of IE is used in the WPF .NET 3.5sp1 frame control?

When using the frame control to display web content? thanks ...

c# .NET dynamic object name

I haven't worked with Reflection since the last time I touched Java and I'm a little rusty. I've created a Windows service that uses timers and for some of the classes I need the object name to be dynamic (pulled from a sql table). The scope of the objects' creation is within a while loop and I need to be able to save each object's prope...

Loaded event not firing in Silverlight

In the following code, person.Children contains 3 other Person objects. This code adds the child.Loaded event handler to all three, but child_Loaded only executes for the first two. Any idea why this is? foreach ( Person child in person.Children) { //Add children in same position as parent child.x_Positio...

What types of restrictions are in place to keep me from modifying built in types in .NET?

If there are types that I want to modify to meet the project requirements, what type of restrictions are there for this? By modifying I mean: Finding the type you are interested that is closest to what you need. Using the reflector to disassemble it. Modifying it based on your own spec. Using the new type (in another namespace) in you...

Sending cookies using HttpCookieCollection and CookieContainer

Hi everyone, I want to tunnel through an HTTP request from my server to a remote server, passing through all the cookies. So I create a new Http**Web**Request object and want to set cookies on it. Http**Web**Request.CookieContainer is type System.Net.CookieContainer which holds System.Net.Cookies On my incoming request object: HttpRe...

InvalidArgumentException not available in Silverlight 3 class library?

I tried to throw an InvalidArgumentException in a Silverlight 3 class library, and this type is not available. It doesn't even give me the red underline that tells me it's in a referenced assembly but I just need to import or fully qualify the namespace. Do I have to import a whole other assembly just to get this exception class, or do...

How to get short "domain name" from dns domain name?

Forgive me if my understanding of this topic has some shortcomings, I only know what I know about domains and active directory because of what I've picked up from working with them. There are two different "versions" of a domain name. The first is what I call the DNS domain name which would be like company.int (for the user max@company....

Normalize directory names in C#

Here's the problem, I have a bunch of directories like S:\HELLO\HI S:\HELLO2\HI\HElloAgain On the file system it shows these directories as S:\hello\Hi S:\hello2\Hi\helloAgain Is there any function in C# that will give me what the file system name of a directory is with the proper casing? ...

Dynamically populate an InfoPath DropownList with managed code

I have an InfoPath form with custom C# code, and a Sharepoint list. I have a dropdownlist in the InfoPath form that I want to populate with a certain field from the Sharepoint list (I want the InfoPath dropdownlist to contain this field's value from every item in the Sharepoint list. I can successfully get the list of values I need fro...

64-Bit VB.NET Allocating > 2GB of RAM (.NET bug?)

I have a 64 bit VB.NET application and want to allocate a buffer > 2GB in size. In the following code both the "new" and the "ReDim" throw an "OverflowException." How can I allocate buffers > 2GB when these functions only accept signed 32 bit values? (Is this possible in C#?) Edit - I am running WinXP 64 with 4GB of RAM. Dim width ...

llblgen - Adding subtype record to existing hierarchical record

In llblgen's documentation the example used to describe a hierarchy is Employee - Manager - BoardMember. Assuming you had an existing Manager entity and you wanted to "promote" them to a BoardMember. How would you suggest adding the new BoardMember entity such that it extends an existing hierarchy of database records. The basic goal is...

I can't seem to understand this .NET assembly signing thing

Ok, I must be dumb cause I've already read this: http://www.csharp411.com/net-assembly-faq-part-3-strong-names-and-signing/ And I still don't get it... Let's say I open my project's properties and go to the "Signing" tab, then I check "Sign the assembly" and generate a new assembly with a password. A strong name key file with the .pfx ...