.net

Deploying NLog with a ClickOnce application

Users are not able to install a ClickOnce application. The error is: "File NLog.dll is not a valid Portable Executable (PE) file." It works fine on my machine, but I have nLog installed. That's not possible for client machines. Any ideas how to get this to work? ...

What is the most performant way to check for existence with a collection of integers?

I have a large list of integers that are sent to my webservice. Our business rules state that these values must be unique. What is the most performant way to figure out if there are any duplicates? I dont need to know the values, I only need to know if 2 of the values are equal. At first I was thinking about using a Generic List of i...

Adding a COM Reference with Visual Studio renames interfaces in Interop Assembly

Hey all, I'm adding a C++ COM dll as a reference to a C# project (Visual Studio 2008). VS adds the reference however the generated interop library does not reflect the naming in the original typelib (.idl) definition. Here's what my library definition looks like: [ uuid(...), helpstring("MyLib") ] library MyLib { [ uuid(......

Google bot .net and AspxAutoDetectCookieSupport dilemma

Hi, i have a .net mobile web site where i use sesion state and due to nature of mobile networks/phones (not all supports session cookies) i had to use <sessionState cookieless="AutoDetect"/> It works fine but because each new session redirected with "AspxAutoDetectCookieSupport=1" i have a feeling that google won't like this. Here ...

Is it possible to enforce web service calls from known client only?

Scenario: A publically available Web Service that I have full control over. But I only want this specific desktop application (my published application) to have access to the Web Service. I could store a secret password in the desktop client, but that would be easy to crack. Is there any known implementation that enforces this? PKI, as...

How to cast Generic Lists dynamically in C#?

I'm trying to cast List<object> to List<string> dynamically. I've tried several ways, but I can't find a solution. This is a small sample that shows the problem: List<object> listObject = new List<object>(); listObject.Add("ITEM 1"); listObject.Add("ITEM 2"); listObject.Add("ITEM 3"); List<string> listString = ¿¿listObject??; Thanks ...

Returning a value from thread?

How to Return a value from a thread? in .NET ...

Is it required to call ResolveUrl() before LoadControl() ?

Is it required to call TemplateControl.ResolveUrl() before passing it to TemplateControl.LoadControl()? Which way is preferred? LoadControl(ResolveUrl("~/MyControl.ascx")); LoadControl("~/MyControl.ascx"); LoadControl("MyControl.ascx"); or maybe ResolveClientUrl() ? ...

Hashsets and different instances of class with all members identical

Let's say I have a class called myclass. In my code I have two instances of myclass, myclass1 and myclass2. Everything about them is (public and private) properties are identical. If I try to add both of them to a HashSet will it add both or only one? If it adds both and I don't want it to, can I overidde equals in the myclass definiti...

For .NET Framework, which is the best expresion evaluation engine you have used?

Hi, Need to use an expresion evaluation engine for a .NET project. So far I have found these two: FLEE - http://flee.codeplex.com/ NCALC - http://www.codeplex.com/ncalc Wondering if any of you have used one of these or perhaps a new one I not aware of. Please, share your experience. Thanks a lot. albertop ...

Why do I get a http response 206 when loading a .Net control .dll (activex) file in IE?

So I'm still struggling with the sucky fact that if you make a .net user control deploy as a .dll file to embed it in IE you have to have the user add the site as a trusted site AND modify their .Net security settings. If I don't do the above two things (add trusted site and modify .Net security settings) I get a http response 206 when ...

Accepting a limited set of subtypes in a method argument

This is with C# and .net 3.5 Let's say I have the following method: myMethod(myBaseClass mbc) In my project, all the following classes inherit from myBaseClass. ot1:myBaseClass ot2:myBaseClass ot3:myBaseClass ot4:myBaseClass Are there any tricks that will let me use myMethod with ot1 and ot3 but NOT ot2 and ot4, or do I basically ...

How do I add an HTTP header to a web service call?

I'm calling a web service from a console app - all in C# on .NET. I want to add an HTTP header (not a SOAP header) to the web service call. How do I do this? This is what my code looks like so far: EatService es = new EatService(); // web service added in Web References // Add HTTP header X-Info = "extra info" here string info = es.Ge...

Calling C# from native C++, without /clr or COM?

This question has been asked before, but I never found a truly satisfying solution - I have a class library written in C#, and I want to call it from a legacy native C++ application. The host application is truly native, compiled on Windows & Linux, its a console application. So how can I make it call the C# class library, assuming usin...

Books or other resources for learning Visual Studio?

Some background: I used Visual Studio quite a bit back in the pre-.Net days, and I'm now moving towards using it again. In the interveining years, I've been doing a lot of coding in other environments (Java, Python, Perl, C++, embedded C, lots of HTML/CSS/Javascript, etc) as well as a fair amount of .Net work that just didn't use Visual...

Deploying activex DLL via msi file results in red x in IE after user clicks trust.

I'm getting so so close to deploying my .Net dll user control in IE, somebody suggested trying to package it inside an msi file (instead of directly linking to the dll in the object tag) so that the user gets the trust prompts. So I followed the directions here: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/8ddd0fd...

How do I customize my type's XAML attribute representation?

Say I have a Date, or a Phone number, or some Class which I don't actually want to store as a string at runtime, but which could have a nice short string serialization for serialization as a XAML attribute: <Person PhoneNumber="+1-123-123-1234"/> How do I make my type serialized in that representation? ...

Is there a way to generate(emit) code at runtime in medium trust?

I would like to know if there is something similar to CSharpCodeProvider, but it should work in ASP.NET Medium Trust, anyone knows a good one? [EDIT 08-25-2009] Why I want to do that? I was writing a simple tutorial about Link to Objects and I would like users could write some simple querys on a textbox, post it to server to see the ...

How can I create a custom *write-only* dependency-property?

I need to know what the procedure is for making a write-only dependency-property. I can see that the DependencyProperty class does not have a special "Register" method for write-only properties, but I have no idea whether the RegisterAttached method may apply to what I am trying to do. This property needs to be a dependency-property, ...

Silverlight file upload tutorial?

Hello everyone, I am using Silverlight 2 and new to Silverlight 2. I want to develop a ASP.Net web application which uses Silverlight at client side (in browser) to let end user select a file to upload to server side. The server is running ASP.Net 3.5 on IIS 7.0. A special requirement is I want to control the upload speed, for example, ...