.net

Does the .NET runtime internally map to win32 function calls?

In other words, does the .NET framework eventually make calls somewhere to get its work done? Or did Microsoft completely re-create all the functionality of the win32 library in their .NET framework. Thanks! ...

How can I get the filename of a Word document from C#?

I'm working on a MS Word AddIn (VSTO). The idea is that I work on a Word document and I send it somewhere. I have all the code I need except one thing: is there a way I can get the filename of the Word document I'm working on? (assuming that is already saved) ...

Winforms UserControl shows rectangles with Inverted Colors

In a Winforms application (C#2, FX2.0, VC2008) I am using a Panel derived Control to display custom controls. The controls are arranged vertically and there are usually more than fit in the visible area of the panel. I have drawn a litte sketch of it: Sometimes (usually after scrolling inside the panel) rectangular areas appear to ha...

Sending attachments from Axis webservice to .NET client?

Trying to provide a web service capable of sending files to a client on request, I run into the following problem: On the server side, the service is written in Java, using Axis 1 v1.4.1 (I know, it's obsolete, but it's a legacy application which I'm supposed to extend, and the effort involved in migrating to something more up-to-date, ...

Why does this code work without the unsafe keyword?

In an answer to his own controversial question, Mash has illustrated that you don't need the "unsafe" keyword to read and write directly to the bytes of any .NET object instance. You can declare the following types: [StructLayout(LayoutKind.Explicit)] struct MemoryAccess { [FieldOffset(0)] public object Object; ...

c# choosing class properties with a variable?

Hello All, I'm adding functionality to one of our existing (but broken) systems. It grabs an XML file from a web service, parses it and then does some stuff before packing it back into our database. the previous developer (who has now left) left me this little gem: http://dl.getdropbox.com/u/109069/wut.GIF and I wonder if there's a ...

XmlConvert and nullable results?

In my project I receive an XmlElement of which I have to parse a few properties back to a class. For mapping these I use the XmlConvert class. But the source being XML there often are empty nodes or nodes that are not readable. Rather then throwing a bunch of errors, I want to get a NULL back to store in my class. I started making ...

An error occurred while enlisting in a distributed transaction (System.EnterpriseServices)

I encountered the following error when I tried to perform insert/update operations via component services with TransactionOption.Required. InvalidOperationException: An error occurred while enlisting in a distributed transaction. Specifications .NET Framework 1.1 SQL Server 2000 Windows Server 2003 ...

Sync Content on Multiple Servers

We have a site which sits on two load balanced application servers (Win 2K3) which comprises a C#/ASP.NET app and a bunch of static content which changes on a daily basis. My question is, what's the best way to keep the static content in sync. In Win2K8 we'd be able to point both servers at a shared directory but not in Win2K3. Ther...

How to read XML into a class/classes that matches its xsd

So I have an XSD and a webservice that delivers in that same format. Now I could go ahead and read the xml into a document, create my objects from the class etc... But I am thinking, there must be some easier way to do that. Am I right? ;) Yahoo Maps GeocodeResponse XSD Yahoo Maps GeocodeResponse sample <ResultSet xsi:schemaLoc...

Disadvantages and Advantages of separated projects/DLLs in .NET? How many of them are too much?

The question involves some other related questions, I'll just throw every single on of them feel free to answer one or many of them. What are the advantages of separating Projects/DLL? What are the disadvantages of separating Projects/DLL? If I create a new solution/DLL for every shareable resource, isn't going to be lots of projects? ...

Handle www-authentication request using ajax?

Is it possible to pass credentials using AJAX to a webserver that request www-authentication? I want to log in to a website that uses .NET Bsic www-authentication, and pass the credentials using ajax. When visiting the server with a browser, the browser prompts the user with an authentication/login window. The html header contains this...

Is there a 'NotImplementedAttribute' in .NET?

Duplicate Custom Compiler Warnings in .NET I'd like to be able to tag my code with a NotImplementedAttribute and have the compiler either give a warning or an error at build time if the method is used. I know there is the ObsoleteAttribute, but that communicates something very different. ...

calling unmanaged function char returns char *

I have a function in unmanaged C/C++ code (dll) that returns a structure containing a char array. I created C# struct to receive this return value uppon calling the function. And uppon calling this function i get 'System.Runtime.InteropServices.MarshalDirectiveException' This is C declaration: typedef struct T_SAMPLE_STRUCT { int num; ...

Preventing anonymous user from submiting form many times in ASP.NET without SqlMembershipProvider

Hi, I have a simple form that dumps selected answers to XML file. How to prevent anonymous user from submitting this form many times? I am not looking for totally bulletproof solution, and I have a limitation that I cannot use the database, and therefore no SqlMembershipProvider. Will some cookie checking work? How to do this right? ...

Is ASP.NET MVC worth looking into?

Now that ASP.NET MVC has had its official release, should I be looking into it for my team? We're quite a small team (6 developers), developing mainly in-house applications for administrative teams. Any, and all, advice is appreciated. ...

Unit Testing Training?

We have recently started a periodic DnrTv lunch and learn for my group. There is interest from the group to learn more about Unit Testing, but I have not been able to find any good video's on the subject. Specifically Unit Testing within Visual Studio 2008. Anyone have suggestions of video training (dnrTv, DimeCasts, etc) that might h...

Use of anonymous class in C#

We all know that, when we create anonymous class var Employee = new { ID = 5, Name= "Prashant" }; at run time it will be of type <>f__AnonymousType0<int,string> is there any way to specify some meaningfully name to these classes ?? ...

How do you compare dataset structure in ado .net?

I need to compare the table structure of two datasets to check for any discrepencies, is this possible? I had though of converting to XML and comparing but is there a better way? Thanks ...

Split F# modules across multiple files

Is it possible to split an F# module across files? According to the book I have it is, but the book is probably outdated (Foundations of F#) ...