.net

Using .snk's private key to sign arbitrary data

I'm developing a .NET package manager and one thing that got me thinking is security. Given that anybody can potentially upload an assembly to the repository, how do I verify that said assembly comes from a trusted source? For example, I'd trust NHibernate.dll much more if it was signed with a private key of guys from NHForge. To ensur...

Adding WCF service reference with additional DLL breaks

I have the following classes defined in an external assembly from a third-party vendor: namespace ThirdParty.Vendor.Code { [Serializable] [XmlInclude(typeof(Test1Data))] [XmlRoot(Namespace = "", IsNullable = false)] public abstract class DeviceTestData { protected DeviceTestData(); } [Serializable] [XmlRoot(Namespac...

LINQ2SQL vs EF4: Entity retrieval and usage from different contexts

Hi I am long time user of LINQ2SQL, but have not used the Entity Framework yet. One thing that is not possible in LINQ2SQL is to use tracked entities in different data contexts, or 'link' objects from different data contexts. Example: Foo f = null; using (var dc = new DB()) f = dc.Foos.Single(x => x.ID = 1); using (var dc = new...

One DataSource with two tables for two grids

I calculate (Create from some queries) first table in my DataSource Select method then I need to make some basic calculation (statistics of first table, like summ for columns) with this table and create second table for second Grid, so how can I provide single calculation for two Grids ? Thank you. ...

Windows WCF client with internet proxy server showing error The server committed a protocol violation. Section=ResponseStatusLine

Our team trying to create a windows application(c#) to call a WCF service using internet proxy server Showing exception "The server committed a protocol violation. Section=ResponseStatusLine" while calling WCF service Please give suggestion to solve this problem/any other alternative solution //Code for creating proxy public static De...

How to get Router Name & IP as shown in Windows Network Tab? (in Code)

Basically, if you go to Start and click Computer and then click on the Network link on the left hand side, you'll notice on the right hand side several categories, one of which is titled "Network Infrustructure", in that category, my router is listed, and in my case, it is "LINKSYS WAG160N Wireless-N ADSL2+ Gateway" and when you right-cl...

Is there possibility to create *.config file from scratch programatically in .NET (C#) ?

For our approach we want to create one of the *.config files from scratch and populate it with some default/custom values at runtime. Is there possibility to do this programatically via ConfigurationManager or something like that? ...

VsInstr performance profiling

I have a problem with building performance profile for my .net web app See my steps below: Setup global variables VSPerfCLREnv /traceon VSPerfCLREnv /globaltranceon Instrument assemblies vsinstr "path to my assembly" Restart iis iisreset Start profiling VSPerfCmd /start:trace /output:traceoutput.vsp...

iTextSharp center align objects within the Document object

Hi Everyone Is there a quick and simple way to center align objects within the Document object? Without performing any calculation logic, ie. Get width of page, get width of contents, divide by two, etc. I have a PdfPTable object within a Paragraph object, within the Document object. I would like to center the Paragraph object. Than...

DOFactory Design patterns. Anyone bought it ??? IS it any good

anyone bought the dofactory Design Patterns Framework ??? Did you find it to be any good??? http://www.dofactory.com/Framework/Framework.aspx thanks Niall ...

How to check a type of item in ListBox

Need to find out the type of an element inside a listBox, whether the type is button or radio button or simple string. Something lie the snippet below: foreach (ListBoxItem _item in listPhotoAlbum.ItemsSource) { if _item is of type of button //DO this ...

Is Microsoft.SmartDevice.Connectivity properly COM-registered?

I'm trying to use the Microsoft.SmartDevice.Connectivity library to talk to a windows phone 7 device, but whenever I try to create a DatastoreManager (which is the first step) I get a COMException about guid {250BEABB-55E8-43BB-AC97-2D95674ECE14} (which corresponds to the Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManClass type...

Custom control cause Visual Studio 2008 to CRASH

The following code is a custom control. Using this control in the Visual Studio designer cause Visual Studio to CRASH without any noticeable details. I'm using Visual Studio 2008. Am I doing something wrong here? using System; using System.Text; using System.Windows.Forms; using System.Drawing; namespace InstalacionesSayma.GUI { ...

Visual Studio 2010, Crystal Report for Visual Studio 2008 and ClickOnce

I'm in a bit of trouble here. I upgraded one of our Winforms products from VS2008 to VS2010 about 4 weeks ago. The conversion was fine but we used Crystal Reports so had to install the VS2010 Crsytal Reports for Visual Studio 2010 Beta 2. This was fine and gave me the designer etc. back for crystal. I chose not to convert the reports...

C# How to report nonspecific memory usage.

So I'm trying demonstrate to my uppers that the product contains a memory leak. However, it takes about 2 hours of running a script that touches a COM object to duplicate up to an OutOfMemoryException. In order to make this presentable, I'll need data for a baseline to show that it's not my script itself that's causing the memory proble...

How do i use System.Net.NetworkInformation.GatewayIPAddressInformation Class?

I tried every trick in the book, creating a new object, instantiating it (even tho it says i can't) and just trying to create a reference to use it, and then also trying to call the .Address value inside it while using it like i would use a shared member (without instantiation) and nothing is working, msdn sample/help is useless... i eve...

Simple CMS for .Net Webshop

Hi, Im not sure if this is the correct forum for this, if not I apologize. Here goes: Im trying to develop a webshop that should be very simple for the users. Simply add products, create pages, some kind of payment methods and order status. It shoulde also be fairly easy to set up new webshops. Im am currently trying to do this in Umbra...

AsParallel with classic ADO.NET

I'm wondering if using by AsParallel would speed up my code in the way we use it. I write here some very simplified pseudo code, to illustrate what I have in mind: Let's say 3 SqlCommand under the same SqlConnection like this (pseudo code): RunADOQueryForRequest() // returns one row RunADOQueryForRequestAnswer() // returns about 100 r...

How should I expose an enum?

Here's my situation. I have a library that has a set of enums that I need to use. public enum showtype { comedy = 1001, horror = 1002, mystery = 1003, action = 1004; } This library is being referenced by another library that I created. My library is referenced by more than one console based app. I need to assign the show type dir...

Unable to successfully receive JSON data to .NET MVC Controller

Hi, I'm aiming to build up a JSON array of mouse positions and pass them to a controller. For some reason my json is returning from the controller as undefined can anyone spot my problem? // Attempt at declaring a JSON object var personResults = { "answers": [] }; // Onclick I fire in values from mouse event personResults.answers[cou...