.net

Is using Kerberos to authenticate to web sites and web services a good idea?

Through acquisition we have a number of products that require authentication and authorisation. The products include web sites and client side applications, the client side applications use some web services. We are a .Net shop and servers will be running Server 2008, clients will be running XP SP?? and later. Users of the products are ...

What are your favorite custom extension methods?

Duplicate: Post your extension goodies for C# .Net (codeplex.com/extensionoverflow) Let's create a list of your favorite extension methods. To qualify it should be an extension method you use often and makes coding easier by being either elegant, clever, powerful or just very cool. I'll start with my 3 favorite extension methods...

Please help with 'System.Data.DataRowView' does not contain a property with the name...

My application works just fine until, in some unidentified conditions, it begins throwing this errors: When these errors start appearing, they appear in all over the application, no matter the code is built using ObjectDataSource or SqlDataSource. However, apparently, if the code uses some "classic", code-behind data-binding, that code ...

ASP.NET Database Error Trapping

I am curious as to how people trap certain database errors in .NET, particulary foreign key or unique index violations. Coming from a Classic ASP/VB background, my first inclination is to test the error number to then create a friendly message to the user that something is wrong. However, I would think that in the .NET world, there wou...

best practices when creating testing and deploying windows services ?

i building a small windows service (not a web service) that periodically check for some data and based on that and call a class library to do some work BTW: this is the first time i try to create a windows service ...

Security error in cross domain iframe

Hi All, I have a click tracker for a client. The tracker is nothing but a javascript snippet which writes an iframe(a different domain) into the page. If I have a normal iframe I am able to track clicks more accuratley(I compare the data from another tracking solution) than when the iframe is secure(the site is accessed over ssl). Wh...

C# Capabilities?

Hello, I've searched high and low for a list of the contents of .net 3.0 and 3.5 framework, since i've been programming using old technologies such as hashtables instead of a dictionary(newer technology). I've been having a bit of a swat up and wondered where I can find a list of all the latest capabilities of C# and the .Net framework...

Email handling in C#

I need to know the object name for handling emails in C#/.NET Framework. ...

How can I write a regular expression to capture links with no link text?

How can I write a regular expression to replace links with no link text like this: <a href="http://www.somesite.com"&gt;&lt;/a&gt; with <a href="http://www.somesite.com"&gt;http://www.somesite.com&lt;/a&gt; ? This is what I was trying to do to capture the matches, and it isn't catching any. What am I doing wrong? string pattern ...

Rule of thumb for amount of usage memory it takes to make a worker process recycle?

I've got a code base with lots of this: byte[] contents = FileUtils.FileToByteArray(FileOfGartantuanProportions); I don't control my IIS server, so I can't see the system log or do instrumentation, I just get to see my request fail to return (white page of death) and sometimes YSOD with Out of Memory error. Does anyone have a rule of...

.Net equivalent of the old vb left(string, length) function?

As a non .net programmer I'm looking for the .net equivalent of the old vb function left(string, length). It was lazy in that it worked for any length string. As expected, left("foobar", 3) = "foo" while, most helpfully, left("f", 3) = "f". In .net string.Substring(index, length) throws exceptions for everything out of range. In Java I ...

Is there a built-in extension methods on collections like Apply?

I am looking for a built-in extension method like Apply: collection.Apply (predicate) which will apply a method on all items contained in the collection. I am asking first so that I don't write something that already exists. EDIT: The reason I didn't use foreach was because I want to express the method using LINQ. ...

Is there a way to declare timeout period with NUnit?

I would like to be able to fail the test if the executing code hangs. Is there a way to do this currently? I am thinking something like the following must exist, but I can't seem to find it in the API [Test, Timeout(TimeSpan.FromSeconds(2))] public void Test() { ...} ...

Implicit (default) values vs Explicit values

Is it a bad practice to rely on implicit default values, like: class Node { int red; int green; int blue; bool grayscale; Node next; } Instead of explicitly setting them: class Node { int red = 0; int green = 0; int blue = 0; bool grayscale = false; Node next = null; } ...

AccessViolationException on calling the most basic c++ function I can think of from managed code

Hi all, I'm trying to learn how to use managed/unmanaged code interop, but I've hit a wall that 4 hours of googling wasn't able to get over. I put together 2 projects in visual studio, one creating a win32 exe, and one creating a windows forms .NET application. After a bunch of mucking around I got the C# code to call into the c++...

Which is not a reason to create a custom exception?

Hello, Recently I took a test at brainbench and got not a bad result (something like 4.5, master degree). I didn't know the answer only on 1 question (the rest I was sure about or at least I thought I knew the correct answer :) ). The question is: Which one of the following is NOT a reason to create custom exceptions? Choice 1 T...

Modifying values directly using LINQ?

Is it possible to modify elements of a collection, say List, LinkedList, etc using something like: collection.Do ( action ) which does something like: item.Value = 0 (for each item) I know enumerators only give the value, not the reference, hence the question. How would one do this using LINQ? ...

Convert StringCollection to List<String>

Normally, I'd choose List<String> [or, in VB, List(Of String)] over StringCollection whenever possible: see also Best string container. However, as it seems, generics — and hence, List<String> — are apparently not supported in VS 2008's settings designer. Therefore, if I want to use a list of strings in my user settings, I have to resor...

How do I work with multiple files and C# libraries in F#?

I have a C# library with the following Namespace/Class: namespace Helper { public static class Util { /*static methods*/ } } I have referenced said library in a F# project and when I try to call one of the methods I get: error FS0039: The namespace or module 'Helper' is not defined. This is an example of the me...

ListViewGroups not working correctly

I'm working with a ListView control in Windows Forms using C# and .NET 3.5. I have several items that I'm adding to this ListView control, and I have functionality in place that is supposed to allow the user to select different ways to group the items in the list. However, sometimes items get dumped into the automatically generated "Defa...