.net

Distributed locking in .NET

I'm looking for recommendations for a locking mechanism that will work across multiple machines. In my case I basically just want to be able to start a service on 2 machines and have one block until the other finishes as a simple way to insure redundancy in case a service machine goes down. Sort of along the same lines as http://stacko...

.NET Settings File Available Types

When modifying a .NET settings file, I'm given a choice of types for a setting. However, not all of the types accessible by my project appear, even in the 'Browse' window. What determines if a type can be used for a setting file setting? I have a type I created that I would like to be able to save, and I want to know what I need to cha...

Mutual authentication SOAP error

My apologies if this has limited information. I'll add more info if somebody asks for it. I'm just not sure what to give you. I'm making a SOAP call to a 3rd party. They require mutual authentication. This means their servers send an SSL cert to me. I send one to them. Then in the SOAP message there's another cert. Given that in the co...

Is Socket ReceiveFromAsync implicltly multi threaded?

I'm currently working on a high performance Raw socket application. I'm using ReceiveFromAsync to receive packets. This may sound like a silly question, but is this implicitly threaded? I'm not sure if i need to take the received packet and thread off the handling to ensure I'm not blocking any additional packets while i handle the curr...

ASP.NET MVC: How to convert View Model into Json object.

I am Java developer new to .NET. I am working on a .Net MVC2 project where I want to have a partial view to wrap a widget. Each JS widget object has a JSON data object that would be populated by the model data. Then methods to update this data bound to events when data is changed in the widget or if that data is changed in another widge...

DataTable Pivot method with composite key field

I need a C# method that can pivot a DataTable/IDataReader object where the source table contains a composite key. I wanted to use this: http://weblogs.sqlteam.com/jeffs/articles/5091.aspx however it only works for a single key column. No SQL, it must be C#. ...

What websites have the best and most user-friendly login systems?

StackOverflow does openid well and Quora does the Facebook connect and Twitter well....but one problem I had with Quora is that I can either login with my Facebook or Twitter account, but not both, so there is no way to import friends from both under the same account. Which is what lead me to ask here, in case there are other sites with...

How to convert 'open web site from folder' to csproj based 'ASP.NET Web Application' project

The title pretty much says it all, I've got a 'web site' that was built and checked into vss and to open it we are going to file > open > web site, and picking the folder. This is the technique that gets you a project but without a cs/vb proj file. Is there any easy way to convert this to an 'ASP.NET Web Application' project, complete ...

Is there a tried and true way of accessing specific areas of a very large (>1GB) binary file very fast in .Net

Using a very large raw binary data file, I will be creating a large binary file (greater than 1 GB, usually greater than 4 GB) that contains sensor data from an arbituary number of sensors (1 to 64). The new processed file will be used by user in a GUI where they will be jumping around the file looking at different time periods or other ...

Running managed code in SQL Server 2008 - any issues?

I would like to know the performance issues associated with running managed code through SQL Server 2008. I've heard about some memory and speed issues. Specifically, I want to implement a SHA256 hashing DLL and execute it as a sproc with SQL Server 2008. Alternately, I could simply execute the hashing from my .Net app, then pass the ...

Organizing c# project helper classes

Whats are some best practices for where you should have helper classes in a .NET project? Referring to classes separate from business layer stuff, but presentation and app stuff like appsetting config managers and other code that would sometimes be module specific or sometimes be used throughout the app. ...

Set a default value to a property and make it serializable.

Hi, I need to set a default value for a property, but I can't do it like this: private int prop = 1; public Prop { get {return prop;}... } Because I need to serialize this class, and if I do it, I loose the default value. Exists any solution that works after the serialization and before, adding an attribute to the property or somet...

Difference between CLR and CLI

Possible Duplicate: CLR and CLI - What is the difference? What is the difference between CLR and CLI? (in .NET) ...

How can I manipulate appsettings in a web.config on a remote machine using Microsoft.Web.Administration?

I'm using the Microsoft.Web.Administration library to configure a web.config on a remote machine. I've been able to read sections and add new items for the most part using the GetWebConfiguration method on the Application object, but I've run into a snag with appSettings. I would like to be able to read and write to the appsettings sect...

Are .Net switch statements hashed or indexed?

Does .Net 4 (or any prior version) perform any sort of optimization on longer switch statements based on strings? I'm working around a potential performance bottleneck due to some long switch statements looking for matching strings in the cases, and I've always assumed these are searched in linear time (or near linear, i.e. not using a...

CLR differences between Silverlight and normal .NET Framework?

Are there any aggregated guides to writing libraries which need to be Silverlight-compatible? Or is the standard procedure to just build, look for errors, fix, repeat? Obviously I recognize the answer may depend on what version of Silverlight is being targeted, but I'd expect any answer to just specify version if the solution is specif...

What is the correct way in .NET to encode an XML string for Posting to a URL?

For the first time, I am having to use a vendor's API by posting an XML dataset to a URL. If I encode the dataset using http://meyerweb.com/eric/tools/dencoder/, and manually paste the URL & dataset into a browser, I get a successful response. However, when trying to do the same thing with .NET, I get a response from the vendor API ind...

How to break connections TCP/IP by keepalive postgreSQL without changing anything in the register?

Hy, I have a system working with the client-server structure and PostgreSQL 8.4. My problem is that if a client is editing a record and lose his connection to the server,the TCPIP connection is still considered! So, the record stay allocated for the client in my database. I need the records to be free for edit in a few minutes. There...

C# - failed parse exception?

I am writing a program in C#, and I want to catch exceptions caused by converting "" (null) to int. What is the exception's name? EDIT: I'm not sure i can show here the full code... But i'm sure you don't need the full code, so: int num1 = Int32.Parse(number1.Text); int num2 = Int32.Parse(number2.Text); ...

Is there a way to get the current capacity of a HashSet?

Maybe I'm just missing something, but the HashSet(Of T) class has as TrimExcess method, but no publicly accessible way of finding out the current capacity of an instance. Is there some way I'm being too dense to find? ...