.net

Changing values in Web.config with a Batch file or in .NET code

Hi I have a web.config file on my computer. There are alot of things i need to change and add in the file. (I am actually working with my SharePoint web.config file) Can i do this with a Batch file, if so how would i do it. Or how would i do it using VB.NET or C# code? Any ideas guys? Edit: i need to create a program to alter a web....

Is it possible to do secure sockets (not https) with silverlight 2/3 ?

I need to do push feed to clients (not through polling), to silverlight clients fast and securely, is it possible to do secure sockets with silverlight ? ...

Would you use the S#arp Architecture in a new commercial project?

The S#arp Architecture seems really cool, but do you think it's still too new to make the commitment to it in an important new project? (Let's assume the project appears to be a good fit for it at first glance.) It all seems very good, I'm just concerned that the new project I'm working on is using all the newer technologies - WCF, ASP....

Validating Event Results in Loss of Button Click Event in Winforms

Background: I have a form with a "clear form" and a "cancel" button. If I have invalid data inside a dropdown and click either of these buttons the dropdown's validating event fires. I've added code to the validating event to succeed when either "clear" or "cancel" are pressed. Problem: I would expect that the next thing that will h...

Calculate date from week number

Anyone know an easy way to get the date of the first day in the week (monday here europe). I know the year and the week number? I'm going to do this in C#. Thanks in advance. ...

Unittesting IList with CollectionAssert

The mstest framework has a CollectionAssert that accepts ICollections. My method returns an IList. Apparantly a list is not a collection.. Are there ways to make my IList an ICollection? ...

Setting Custom Form property gives incorrect result.

I have a parent form with a datagridview. The datagridview's first column is the Primary key of the data. Whenever the user wanted to modify a record, he must select a row from the datagridview then click on the edit button, when the edit form will be loaded. In the edit form, i have a property called CurrentID which represents the prim...

Is there a sImple way to tell if a LINQ to SQL record has been changed?

I've got a simple routine that populates a record in a table. I have fields that I only want to update if an actual change has taken place. The function could get called even if the user did not change anything. Is there an easy way to tell if changes have taken place? Here's the function: Sub Edit(ByVal key as Integer, ByVal myval1 As ...

How can I change the username/password of an ApplicationPool in IIS from C#?

I am using the code below to create a new application pool in the Installer class of my application: private static void CreateAppPool(string serverName, string appPoolName) { // metabasePath is of the form "IIS://<servername>/W3SVC/AppPools" // for example "IIS://localhost/W3SVC/AppPools" // appPoolName is of the form...

What are the security pitfalls in a Silverlight app communicating with a WCF service?

My company is building a medical application. We would like to utilize Silverlight 2.0/3.0. Because of HIPAA laws, security is at the top of the list and can't make mistakes here. What makes or doesn't make a WCF call secure in the context of using Silverlight? ...

Lucene query to exclude docs, but not docs with partial matches

Say I have a set of docs that go like this: mercedes mercedes trucks Is there a way to create a query that will filter out the mercedes, but not the mercedes trucks? ...

.net Text delimited libraries?

Does the .net framework have any builtin assemblies for handling reading and writing from and to text delimited files? Or is this something I have create myself? ...

What is the benefit and model usage of the C# label

Duplicate: What is the use of labels in c#? I was trawling through some .NET Source Code using reflector when I came across something which I see very little of on the web, which is the label syntax. From here I can see that it raises the chance of ugly spaghetti code: goto 1: goto 2: if(booleanProperty) goto 1: Is the purpo...

Whats the best way to get data from other websites programmatically? "amazon offers for example"

I want to build a small application which will go to some websites and read specific data from these website, i want the application to be generic as i can so it work on any website i want later. So there is a good way to parse website using .net? ...

Silverlight: Make part of a storyboard repeat

Is it possible to create a storyboard where the second half repeates, but the first half doesn't? Or alternatively, can I cause one storyboard to start after another finishes, all in xaml? ...

Weird owner-drawn-variable combo box behavior

In my .NET owner-drawn-variable combo box, when I move by page or by mouse wheel, it appears to scroll in the WRONG DIRECTION, but then ends up on the right item. Nothing seems to avoid this behavior. I tried making it owner-drawn-fixed, but it then changed the size of the combo box. How can I make it scroll normally? Thanks in advan...

How can I look up IIS site id in C#?

I am writing an installer class for my web service. In many cases when I use WMI (e.g. when creating virtual directories) I have to know the siteId to provide the correct metabasePath to the site, e.g.: metabasePath is of the form "IIS://<servername>/<service>/<siteID>/Root[/<vdir>]" for example "IIS://localhost/W3SVC/1/Root" How can...

Updating Binding immediately when DataContext changes

I am trying to measure an object immediately after changing the DataContext, but the binding for the object is not getting updated soon enough. Here's my code: // In MeasureOverride(Size) m_inputWidth = 0.0; Size elemSize = new Size(double.PositiveInfinity, RowHeight); MapElementView ruler = new MapElementView(); // Measure inputs for...

Most useful free .NET libraries?

I have used a lot of free .NET libraries, some from Microsoft itself! Which ones have you found the most useful? Package managers for external libraries NuGet (formerly known as NuPack) - Microsoft (developer-focused package management system for the .NET platform intent on simplifying the process of incorporating third party librarie...

Workaround for VB.Net - ByRef parameter of a property

I have a legacy COM-component with an interface declaring a property like this (IDL notation): interface IPasswordCallback : IUnknown { [propget] HRESULT Password( [in] VARIANT_BOOL ownerNeeded, [in, out] VARIANT_BOOL* isResultValid, [out, retval] BSTR* password ); } This interface is implemented in a calling application w...