.net-4.0

Using .Net 4.0 new features for parallel tasks

I've previously asked a question about designing a service that receives video files, sends them to an encoding service, waits for the encoding to be completed, and then downloads the files. I started writing the code for that and one of my workmates suggested I use .Net 4.0 new features, instead of writing it using BackgroundWorker. I'...

hide, or disable, the RibbonWindow icon

.net 4 wpf, microsoft ribbon control library, how do I hide, or disable, the RibbonWindow icon so that users can't double click it to close the window/application? I handle the window closing event, but if the end user double clicks the icon it closes the window even if I set cancel to true within the closing event handler. ...

.Net 4.0 Parallel Programming - how to write data to concurrent collections?

I have a grid which is defined as: List<List<Cell>>, where "Cell" is a custom class of mine. My program has several threads which access various coordinates on the grid, and change data in the "Cell" class. But I only want one thread writing data to a "Cell" object at a time. I thought using concurrent collections such as ConcurrentBag w...

Asynchronous Delegate Invocation (ADI) vs. Task Parallel Library (TPL)

I get this comment on ADI while reading Essential C# 4.0: Unfortunately, the underlying technology used by the asynchronous delegate invocation pattern is an end-of-further-development technology for distributed programming known as remoting. And although Microsoft still supports the use of asynchronous delegate invocat...

WebDav troubles for restfull WCF web service

Hi all, I created a WCF restfull service in .NET 4 and I published it under IIS 7.5/windows 7 x86. The verbs GET and POST worked fine, but the DELETE and PUT gave an error: Error: The remote server returned an error: (405) Method Not Allowed. After googling (a lot), I've found out that the problem is caused by WebDav module which ...

Anonymous delegate closure (or why does this work)?

Hello, The code below is taken directly from the sample project accompanying the article on MSDN introducing MVVM design pattern. I do not quite understand why the delegate sees the value of 'handler' other than null. My understanding was that the closure created for the delegate method contains all variables in scope that have been ini...

how to avoid [Content_Types].xml in .net's ZipPackage class

I wish to know if there is any way to avoid to have a [Content_Types].xml file inside the zip file while using .net's ZipPackage class. ...

Disabling ASP.Net Request.Path Validation

We're running a site with roughly 6000-7000 visitors online concurrently (this is to indicate the size) Having switched from ASP.Net 3.5 to 4.0 we suddenly face a mass of these: A potentially dangerous Request.Path value was detected from the client (>). They're all corrupted URLs, and seem to contain some sort of HTML or javascri...

Cleaner Implementation when passing Properties to Methods

I am writing an csv import engine for a system I'm working on and I wanted to avoid the kind of code that looks like (repeated for 10's of columns): var field = GetFieldStringValue(columnCode); if (IsValidDecimal(field)) { currentRow.Amount = Decimal.Parse(field); } else { ReportError(); } In the end I opted for a method that ...

How to detect .NET 4 from ASP.NET?

I have a web server that is run by a third party. I don't have direct access to the server but I can deploy ASP.NET code to it. I want to detect if that server is running ASP.NET 4 / .NET 4 or not. What is the easiest way to do that? Is there an environmental property somewhere that would tell me? Or should I try to load a particula...

debug:pdbonly difference between .Net 2 and .Net 4

Hello, I followed this example from Scott Hanselmans webpage: http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx My goal is to get the line number from where the exception is thrown not where it is caught. When I compile the code with the following build-script it wont wor...

MessageQueue + ObjectDisposedException + .Net 4.0

Hi, I have implemented a dispose pattern in a class model which uses MessageQueue. My class A where all objects from class B must register to contains a Dictionary with MessageQueue objects. This works all fine. Objects from class B can be collect by GC and the dispose pattern, which let each object from class B sent a last message duri...

how to make single sign on work with asp.net framework 4.0

Hi there, I have a parent web application and a child web application. I am using single sign on between them. The child application is supposed to redirect anonymous users to the login page of the parent application We just updated both to .net 4.0 framework and now the SSO doesn't work anymore. The setup is as follows. I have the...

WCF 4 Router Service configuration issue

I've created a WCF 4 Router Service and am hosting it in IIS7. It works fine on my development machine, but when I deploy to the QA server is returns the following message: The configuration section 'routing' cannot be read because it is missing a section declaration The section it's complaining about is the standard WCF4 routing sect...

Gridview filter and sorting using LINQ

I'm upgrading a project to .net 4. My GridViews are using DataSets and implement filtering, sorting and paging using an ObjectDataSource. What is the best practice to connect a GridView to a Linq query and implement sorting, filtering and paging? Do i still use a DataSet and ObjectDataSource or is there a way to use another type of Da...

Cannot send emails with large attachments in VS 2010

I’ve gone through this link. (http://connect.microsoft.com/VisualStudio/feedback/details/544562/cannot-send-e-mails-with-large-attachments-system-net-mail-smtpclient-system-net-mail-mailmessage) It is not possible to send an e-mail with an attachment larger than 4 MB in .NET Framework 4.0. The same code works for small and large files i...

WPF - ComboBox Not Working Correctly.

Hi, I am developing a WPF appliction in .net 4.0 which has got one user control. For simplicity, this user control has got only one combox which gets its value from view model's observable collection. This observable colletion is populated via a call to EF entity which gets its data from a view. The combobox's itemssource property is bo...

Return custom values from WPF dialog

I am using Window.ShowDialog() method to fetch some values from the user. However, the dialog will only return a nullable bool. How can I get my WPF window to return a Tuple<string,string> or any other type? ...

Debugging .Net 3.5 code running under a .Net 4.0 App Pool

I have trawled the internet - to no avail. Woe is me. I have a .Net website running under a .Net framework 4.0 App Pool. The website references various assemblies that have been compiled for .Net 3.5. I have ensured that identical versions of the dll's and pdb's are in the bin folder of the the 3.5 code that I am trying to debug, and ...

traverse down through a radtreeview

I need to traverse down my radtreeview programmatically. All I have to start with is the root of the tree. I also have to check first if children nodes exist or not. I have done this before in windwos forms but now I have to deal with it in WPF, Telerik RadTreeView control and .NET 4.0. What is the best way to do this? How to I even get ...