.net-4.0

Real world example wcf with rest and soap end points

Hi guys I've been looking around for good wcf samples which expose both WCF and REST endpoints with end to end examples and I am having a bit of trouble finding anything concrete. There are a lot of samples which say you can do this or you could do that, but nothing that really seems to bring it all together. For instance, I'm looking...

.NET 4.0 AppDomain: obsoleted Evidence

I am a .NET student and currently we are learning about Application Domains. We were given the following example code (for .NET 3.5). As expected, it throws a SecurityException. Note: TestApp.exe is added as a reference in the project. Dim file As String = "TestApp.exe" Dim hostEvidence As Object() = {New Zone(SecurityZone.Internet)} Di...

How to configure multiple WCF binding configurations for a single scheme

I have a set of IIS7-hosted net.tcp WCF services that serve my ASP.NET MVC web application. The web application is accessed over the internet. WCF Services (IIS7) <--> ASP.NET MVC Application <--> Client Browser The services are username authenticated, the account that a client (of my web application) uses to logon ends up as the curre...

How to assign default values and define unique keys in Entity Framework 4 Designer

Hello, I've had a look at the Entity Framework 4. While generating code for the SQL Server 2008 I came to the point where I want to define some default values for some fields. how to define in the designer for a Created DateTime Field the DateTime.Now default value? -> Error 54: Default value (DateTime.Now) is not valid for DateTime...

outputting html in runtime in asp.net

Hi all, I'm building a website at the moment, I've some html fragment that is being stored into the database, I've been reading around that inserting HTML at runtime poses security risks by using the InnerHTML property of any html tag with runat server on it. So, my question is there any alternative way to safely display the html code ...

Multithreading improvements in .NET 4

I have heard that the .NET 4 team has added new classes in the framework that make working with threads better and easier. Basically the question is what are the new ways to run multithreaded tasks added in .NET 4 and what are they designed to be used for? UPD: Just to make it clear, I'm not looking for a single way of running parallel...

How to handle all unhandled exceptions when using Task Parallel Library?

I'm using the TPL (Task Parallel Library) in .NET 4.0. I want to be able to centralize the handling logic of all unhandled exceptions by using the Thread.GetDomain().UnhandledException event. However, in my application, the event is never fired for threads started with TPL code, e.g. Task.Factory.StartNew(...). The event is indeed fir...

.Net 4.0 Is There a Business Layer "Technology" ?

Hi, I have a theoretical question about the .net framework. As I see it Microsoft gave us bunch of technologies for different layers. We have the ADO.NET and with the more improved Entity Framework for Data Access. And ASP.NET for WEB UI. And even WCF for Facade and SOA. But what in the middle, what do we have for the Business Laye...

Why isn't ASP.NET MVC 2.0 part of the .NET 4.0 BCL ?

Why isn't ASP.NET MVC 2.0 part of the .NET 4.0 BCL ? ...

Am I stupid? How do I get to use XAML2009 features

I've been reading a little about teh new features available through XAML2009. How do I get to use them in VS2010 (.net 4.0)? Specifically, I want to use x:Arguments and want to know which namespace I need to include (if any). I've read this from the documentation (below), but I can't figure how to get round it? Should I just not use th...

Access to path denied when saving an image with ASP.NET 4.0 project

I have an existing application that was written in .NET 3.5. The piece of code in question is using the FileUpload control and its SaveAs method. Its worked perfectly for the past six months, but I've recently upgraded the project to .NET 4.0 and I'm now receiving an "Access to path (...) is denied" every time the method is called. It...

Changing to new Framework

Hi, I have a solution with many, many projects. How do I change the target framework to .NET 4.0 without going to each one individually and manually changing the dropdown? ...

Problem with System.Net.Dns.GetHostEntry(dnsServer) on .NET 4.0

I have been using the following code for months (without problem) in a .NET 2.0/3.5 environment: string server="192.168.1.3"; IPHostEntry ipe = System.Net.Dns.GetHostEntry(server); IPAddress ipa = ipe.AddressList[0]; IPEndPoint ipep = new IPEndPoint(ipa, (int)UdpServices.Domain); Here, server is hardcoded to an IP address, but in my a...

Silverlight Data Binding for Collection in Stack Panel

I'm new to Silverlight, so I don't have a complete grasp of all the controls at my disposal. What I would like to do is use databinding and a view model to maintain a collection of items. Here is some mock code for what I'd like to do: Model public class MyItem { public string DisplayText { get; set; } public bool...

How do .net 4.0 [named] tuples work under the hood?

I suspect that there is a lot of work done at low level. when names are used for tuple elements, do auto-properties get created? Thanks. ...

membership provider in asp.net 4

has it changed at all since the previous version? Is there a better / lean alternative? (Open source) ...

How to force .NET4 & it's tools to use English for exceptions and other messages.

I would like for my Win7-x64 dev box to remain in the current locale (pl-PL), but at the same time for whole .NET tools to run in English locale. I previous releases this could be achieved by not installing a language pack add-on that came up in windows update. This time it did sneak up and I cannot find it in windows update history and...

Understanding Covariant and Contravariant interfaces in C#

I've come across these in a textbook I am reading on C#, but I am having difficulty understanding them, probably due to lack of context. Is there a good concise explanation of what they are and what they are useful for out there? Edit for clarification: Covariant interface: interface IBibble<out T> . . Contravariant interface: int...

Refferenced by projects .net 4.0 assemblies have no IL. How? and What for?

There is something I don't understand. Today I desided to find out what is inside Sistem.Web.dll version 4.0.0.0 So I decided to find the place where this assembly located. and opened this assembly with reflector - all methods were empty - and then with ilDasm from 7.0 SDK. This what I saw After some research I've found fullfeature...

ASP.NET MVC 2 Display Name DataAnnotaion from Resource not working

Hi, I'm trying to use a resource file to hold label text for the Model in an MVC 2 project. I've got the following class... public class Person { [Display(ResourceType = typeof(Resources.Labels),Name="First")] public string FirstName { get; set; } public string LastName { get; set; } } ...and have tried using... <...