.net

Assembly version

Hi All, What are assemby version like major.minor.build.revision? What does it mean? ...

using asp.net mvc for REST based endpoint

I'm looking at using ASP.Net MVC as a platform for a REST based Service. I know WCF has built in support for REST services; however, I'm looking at returning multiple types of data depending on the request. I would like the client to request the content type. So if they send text/html for example I would render my model into Html, if t...

Regex Email - Ignore leading and trailing spaces?

We are using the following to do an email validation in ASP.NET: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* How can this be modified to ignore leading and trailing spaces? The actual trimming we handle in code on postback but the validator is triggering as being invalid if the user has an extra space often due to copying and paste....

Was FxCop wrong to tell me to use the .Net Uri class?

When getting a URL for something in an Amazon S3 bucket it can append a signature to the end to confirm that the user has permission to view the object and the URL looks like so: https://mybucket.amazonaws.com/mykey?AWSAccessKeyId=myaccesskey& Expires=1235241261&Signature=t5vFBWXaN0DvVaWfck9n2%2fmTzOU%3d These URLs were comin...

Where and When to use LINQ to Objects?

In which situations I should use LINQ to Objects? Obviously I can do everything without LINQ. So in which operations LINQ actually helps me to code shorter and/or more readable? This question triggered by this ...

How do you playback MP4 video in a Windows Forms App

I'm wondering what the best way is to play back an MP4 video in a Windows Forms application (.NET 2.0) on Vista and XP. ...

Why use Mono?

What are the main benefits of using Mono over Java (or any other "free" or Linux-friendly language/runtime)? Mono will always trail behind the latest developments in the .NET framework, why would you want to use Mono over another traditional open-source language/framework (Java)? EDIT: Like someone mentioned below, I guess the root que...

Calling null on a class vs Dispose()

I am fascinated by the way the CLR and GC works (I'm working on expanding my knowledge on this by reading CLR via C#, Jon Skeet's books/posts, and more). Anyway, what is the difference between saying: MyClass myclass = new MyClass(); myclass = null; Or, by making MyClass implement IDisposable and a destructor and calling Dispose()? ...

Should I choose .NET 3.5 or .NET 2.0 for a new application for my cheapskate company?

Normally this would be an easy decision (the answer being "of course"). However, my job does not have its own copy of Visual Studio, and anything I develop will be done on my personal laptop that has an MSDN subscription (this is already cleared with the company). The company is too cheap to pay for Visual Studio, however I have an unu...

ASP.NET web forms as ASP.NET MVC

I am sorry for possible misleading about the title, but I have no idea for a proper title. Feel free to edit. Anyway, I am using ASP.NET Web Forms, and maybe this isn't how web forms is intended to be used, but I like to construct and populate HTML elements manually. It gives me more control. I don't use DataBinding and that kind of s...

Advantage of the asp.net from other technology

Do you know what the advantage of asp.net from other technology? ...

MVC Web Framework and Mono

I work in a shop that has a number of very good C# developers who have been using ASP.NET WebForms, and would like to move to a MVC framework. To make things more complicated, we would also like to be able to run this under mono. So my question is, are there any good MVC frameworks for mono, that have been tried and tested in the real w...

System error 5 Access is denied when starting a .NET service

When I try to start a service I created in Visual Studio I receive the following error: System error 5 has occurred. Access is denied. I am running the command line with elevated privileges, so it's not that problem. Is there any place I can look to see what error is occuring. ...

Html.RenderAction. Why is it not included in MVC RC1?

I am torn between the idea of using Html.RenderAction vs. Html.RenderPartial for partial views. Using RenderPartial means manipulating and passing ViewModel, something I feel is cumbersome. RenderAction is neat and concise in this case but not included for RC1 (included with futures though). Why is it so? Any specific reason? ...

How determine redirect url

How can I know where a url gets redirected programatically? e.g. This url: http://scobleizer.com/feed/ redirects to the following url: http://feeds2.feedburner.com/fastcompany/scobleizer I am trying to read the xml document of feed. But the following lines of code: var doc = new XmlDocument(); doc.Load(url); will throw an exeptio...

What is AppDomain?

What is an AppDomain? What are the benefits of AppDomains or why Microsoft brought the concept of AppDomains, what was the problem without AppDomains? Please elaborate. ...

How do I detect control entering/leaving on a per-application basis, without access to the control's form?

I can use the Control.Enter and Control.Leave events to detect when user focus enters or leaves a control, but this only works on a per-form basis. I use more than one form in my application, and want to track which control has user focus, I have to use the forms' Activated and Deactivated events to track which form is active and then t...

How to impement an event which can be canceled?

Help me please to implement an event, which handler can cancel it. public class BuildStartEventArgs : EventArgs { public bool Cancel { get; set; } } class Foo { public event EventHandler<BuildStartEventArgs> BuildStart; private void Bar() { // build started OnBuildStart(new BuildStartEventArgs()); // how...

Why is it allowed to return unsafe pointers from within a function?

I've recently seen a couple of open source projects that actually do this; return an unsafe pointer from a function such as: "int* input = this.someIterator.GetUnsafePtr()". From my understanding this has to be completely wrong. Unsafe pointers can only be obtained through 'fixed' statements and certainly those returned from within a f...

How can I String.Format a TimeSpan object with a custom format in .NET?

What is the recommended way of formatting TimeSpan objects into a string with a custom format? ...