.net

How to check if file exists on FTP before FtpWebRequest

I need to use FtpWebRequest to put a file in a FTP directory. Before the upload, I would first like to know if this file exists. What method or property should I use to check if this file exists? ...

Pitfalls for converting a .net 1.1 solution to .net 2.0

In this question superwiren asks about the pitfalls for converting a .net 2.0 solution to .net 3.5. What about .net 1.1 to .net 2.0? Is 2.0 fully backwards compatible with 1.1? ...

What's the way to implement Save / Load functionality?

I'm trying to implement a Load / Save function for a winforms applications. I've got following components : A Tree View Couple of List Views Couple of Textboxes Couple of objects (which holds a big dictionarylist) I want to implement a way to save all of this into a file, and resume/load it later on. What's the best way to do this?...

Kill a process on a remote machine in C#

This only helps kills processes on the local machine. How do I kill processes on remote machines? ...

Updating multiple rows Linq vs SQL

Some time ago I wrote a piece of code to update multiple rows in a database table. The code was like this var db = new MyDataContext(); db.Execute("UPDATE Details SET IsActive = 0 WHERE MasterId = 1"); Then the other day when I got the latest version of the file I saw that somebody changed the code to something like this var details ...

Make enter key behave like tab key on form

Is there an easy way to move around controls on a form exactly the same way as the tab key? This includes moving around cells on a datagridview etc. ...

How can I make a setup that makes my software require administrative priviliges while installation?

I have created an application that writes some data to the root folder of the directory in which it was installed (in Program Files). But under Windows Vista, the program is unable to write to the directory because the UAC restricts administrative privileges. I need to be able to do the following Write a file in the folder where the p...

Thoughts on Entity Framework

I was wondering what people thought about the decision to support Entity Framework over LINQ-to-SQL? I have an application I'm developing originally in LINQ-to-SQL. I found it the perfect solution for our application. While attempting to port to Entity Framework I was surprised how rough it was. IMHO, not even close to being ready f...

How can I see a visualization of a dynamic call graph for a .NET program?

Is there a tool out there for visualizing dynamic call graphs? I saw a reference to one for Visual Basic 6 but I'd like one for .NET. If I had to build a visualizer myself should I bother with the .NET profiling API or should I do something with Mono.Cecil? I started writing a CLI runtime with Cecil, but I guess it'd be easier if I just...

Server Error in '/DNNTest' Application

Parser Error Message: The entry 'SiteSqlServer' has already been added. Source Error: Line 23: providerName="System.Data.SqlClient"/> --> Line 24: < ! -- Connection String for SQL Server 2000/2005 --> Line 25: <add name="SiteSqlServer" connectionString="Server=(local); abase=DotNetNuke2; uid=nukeuser;pwd=dotnetnuke;" providerN...

Multiple Dispatchers problem

I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created by a factory on a separate thread and should get a separate Dispatcher. Public Function CreatePresenter(Of T As {New, Class})(ByVal p_eCreationOptions As eViewCreationOptions) As T Impl...

Possible to override null-coalescing operator?

Is it possible to override the null-coalescing operator for a class in C#? Say for example I want to return a default value if an instance is null and return the instance if it's not. The code would look like something like this: return instance ?? new MyClass("Default"); But what if I would like to use the null-coalescing opera...

Applying Extension method to generic class with generic type.

I was working with the generic class in vb.net. And it seems extension method cannot be applied to generic class without specifying the type. I have this generic class Public Class MyGeneric(Of T) 'Methods and properties go here ' ' End Class This is Ok <Extension()> _ Public Sub DoSomething(ByVal myGenericDoubleObj As ...

System.Diagnostics: How to log using an identity

I have implemented tracing based on System.Diagnostics. I am also using a System.Diagnostics.TextWriterTraceListener, and hooked the whole trace up to a MOSS 2007 Web Application. The trace for some reason is trying to (a) create the log file, and/or (b) write to the log file using the user that is currently browsing the SharePoint s...

.net architecture: Creating a IRepository<T> generically

I am using a generic repository interface which allows me to add, find, update and delete objects of different types. I have then implemented two concrete repositories and can switch them around without changing the application. Everything is wonderfully disconnected. But I have hit a snag. The code inside my repository methods just feel...

What other frameworks should asp.net programmer consult?

for code inspiration. ...

.NET built-in helper to parse Domain\Username in User.Identity.Name

Is there any built-in utility or helper to parse HttpContext.Current.User.Identity.Name to get separately domain name if exists and user? Or is there any other class to do so? I udnerstand that it's very easy to call String.Split("\") but just intresting ...

String.Format or Not?

Duplicate from : http://stackoverflow.com/questions/16432/c-string-output-format-or-concat Especially in C# world using String.Format for everything is really common, normally as VB.NET developer unless I have to* I don't String.Format, I prefer normal string concatenation, such as: V1 = V2 & "test-x" & V3 & "-;" to me it's better ...

When do you use StringBuilder.AppendLine/string.Format vs. StringBuilder.AppendFormat?

A recent question came up about using String.Format(). Part of my answer included a suggestion to use StringBuilder.AppendLine(string.Format(...)). Jon Skeet suggested this was a bad example and proposed using a combination of AppendLine and AppendFormat. It occurred to me I've never really settled myself into a "preferred" approach fo...

Find and start a VPN connection in VB .NET

Hi all, I am using NetworkInterface.GetAllNetworkInterfaces() to get all the interfaces on a PC. However, this appears to only return "active" interfaces. How can I find "inactive" network interfaces, such as unconnected VPNs, disabled NICs, etc. in .NET. I would like to find them by their name in "Control Panel" -> "Network Connectio...