.net-4.0

Standard Web Services (.asmx) no longer supported in ASP.NET 4.0 ?

Are the standard web services(.asmx) no longer supported with asp.net 4.0 ... I am using 4.0 but i dont really need all the complications with WCF...should i use old standard web services or WCF for some pretty simple web services? ...

nunit on release build: "Common Language Runtime detected an invalid program."

I upgraded our software from vs2008/.net 3.5 to vs2010/.net 4.0. All third party libraries (most relevant: nhibernate 2.1.2, spring 1.3.0, nunit 2.5.2) are still compiled using vs2008. When I run the unit tests for the debug build of our software, everything works fine. On the release build, nunit reports exceptions on 33 of 228 tests: S...

How do I replace my HTML Submit button with an ActionLink?

I have a view with a submit button. I also have a few ActionLinks on the view. Everything is function right now but I want to repalce the ugly button with an ActionLink to match the rest of the controls that are part of the view. I'm new to MVC. So far, I tried converting the button to a link but I need to post the form, which an action...

Error After Migrating from .NET3.5 to .NET4.0

I have a test declared as: [Test] [ExpectedException(typeof(FaultException<ArgumentException>))] public void ShouldNotBeAbleToDeleteASystemList() When I run this in VS2008 targeting .net 3.5 it all works fine and the test passes as the exception is thrown. I have migrated the solution to VS2010 and changed the target fram...

WPF4 DataGridComboBoxColumn doesn't work

Look how odd is the following scenario: <DataGrid.Columns> <!--Doesn't work--> <DataGridComboBoxColumn Header="Vendor" ItemsSource="{Binding Vendors}" SelectedItemBinding="{Binding Vendor, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Contact.Title"/> <!--Works--> <DataGridTemplateColumn Header=...

.NET 4 method security exception when pinvoking

I've got some code which pinvokes native win32. Since I upgraded to .NET 4, the code started throwing a MethodAccessException saying: Attempt by security transparent method 'Tek.Audio.Midi.MidiDevice.GetDevices()' to call native code through method 'Tek.Native.Windows.Multimedia.midiInGetNumDevs()' failed. Methods must be security crit...

What is the preferred method of handling missing or otherwise unavailable keys in a web.config

In my web.config, appSettings section, I have several keys. What is the preferred way to handle in code any keys that are missing? For example, a key name is changed due to a typo. I know I can use various methods to test if the values of said keys exist but what about the key itself? ...

Is there a version of ELMAH for .NET 4?

I'd like to use ELMAH in an ASP.NET MVC 2 application running on .NET 4, but according to the project hosting site on Google code, it only supports .NET 1.1 and 2.0. Is there a .NET 4 version of ELMAH already, or do I have to download the source and update whatever breaks myself? ...

WPF Webcam component crashes under .NET 4.0

I've got a WPF webcam component's source-code from Codeplex that I'm trying to port from .NET 3.5 to .NET 4.0. Compiles just fine under both targets, but in the .NET 4.0 version, it crashes when running the app with a System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception at the line moniker...

When linking a .NET 2.0 Managed Assembly from a .NET 4.0 Application, which framework is used?

If I have a 2.0 CLR assembly (pure managed code, no mixed mode issues) that I need to link to from a 4.0 CLR Application, does the 2.0 code run on the 2.0 CLR or 4.0. Basically, is there any risk of 4.0 breaking changes affecting the 2.0 code? ...

In Silverlight, how can I get an animation from the template and use it through C# code?

I have a control template that looks like as follows: <ControlTemplate x:Key="anchorButton" TargetType="Button"> <Grid x:Name="CommonGrid" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> <Image x:Name="CommonPic" Source="anchor.png" Width="{TemplateBinding Width}" Height="{TemplateBinding H...

Potentially dangerous Request.Form value only from IE8

I have a Facebook-style modern button control whose client side markup looks like: <button id="ctl00_uxBtn" value="ctl00$uxBtn" name="ctl00$uxBtn type="submit"> <div style="background-image: url("Icons/page_edit.png"); background-position: left center; background-repeat: no-repeat; line-height: 16px; padding: 3px 0pt 3px 22px;">Save D...

Method 'Boolean Contains..' has no supported translation to SQL.

i have this in my query: var results = (from urls in _context.Urls join documents in _context.Documents on urls.UrlId equals documents.DocumentId let words = (from words in _context.Words join hits in _context.Hits on words.WordId equals hits.WordId wh...

Simple rating algorithm to sorting results according to user query

Hi, I'm developing a very basic web search engine that has several parts. After retrieving results according to a user query, I want to calculate rate of each result and then sort results by calculated rate. Here is my query: var tmpQuery = (from urls in _context.Urls join documents in _context.Documents ...

In WPF how do you write an application for multiple screens?

I have been asked to look into writing an application that will be a very very large application, expanding over 9 screens at (obviously) a very high resolution. My question is, what is the best way to go about doing this? Do I just write an application that is (1024x3) x (768x3)? How on earth can I do that at development time? I won't...

How to check if a generic parameter is dynamic in .NET 4.0

I have a class ObjectMapper<T> . Is there any way in .NET 4.0 to tell if typeof(T) is dynamic? I want to be able to determine inside a member method whether the class was initialized as new ObjectMapper<dynamic>() vs. new ObjectMapper<SomeConcreteClass>(). ...

Can't serve text through HTML file in .NET 4

I am trying to verify my website to Google (Apps and Webmasters), and one such method for doing this is to upload an HTML file containing plain text (specific name and specific text). This worked fine under IIS 7 / .NET 2.0/3.0/3.5. I have now switched over to .NET 4, and it seems that ASP.NET is playing silly buggers with me. When I ...

Handling Exceptions in a .NET 4.0 Task Parallel Library Task

I'm working on a Web Hook in .NET 4.0 that will run a lambda asynchronously and then post the result to a given URI when it is finished. I've got that to work, but now I want the Task to handle any exceptions that are thrown, and am finding it difficult to stop them from reaching the parent. Here's part of my code: private readonly Fu...

Should I use Thread.BeginThreadAffinity() when using impersonation?

I understand that impersonation is tied to a single thread. However, managed threads could be shuffled around on top of native Win32 threads, so should I try to bind the identity using Thread.BeginThreadAffinity()? And should I use Thread::ManagedThreadId when checking calls later on an object that manages the impersonation? EDIT: But ...

Win Service project won't Build after switching to Any CPU config.

I'm trying to find a fix for my problem. After changing my .net 4.0 C# Win Service project to Any CPU/Release build configuration, I am getting this compile time error: Cannot specify /main if building a module or library It identifies the offending file as "CSC" and the project generating it is my Service project (not my accompanying ...