.net

ASP.NET: Best way to restrict access by IP address

For an ASP.NET C# application, we will need to restrict access based on IP address. Edit: I liked @Mitch Wheat's answer. Will use this in our implementation. Thanks. ...

Mocking Objects Containing SubObjects With Rhino Mocks

Hi, Assuming an IMouvement Object which contains some subobjects like ITache, IStockPalette. public interface IMouvement : IObjectBase<Guid> { ITache Tache { get; set; } IStockPalette StockPalOrigine { get; set; } } How can I Mock this using Rhino Mocks ? Assuming this test, what's wrong with this ? [TestMethod] pub...

Should you lock resources when reading values?

When doing thread synchronization in C# should I also lock an object when I read a value or just changing it? for example I have Queue<T> object. Should I just lock it when doing the Enqueue and Dequeue or should I also lock it when checking values like Count? ...

How can I take more control in ASP.NET?

I'm trying to build a very, very simple "micro-webapp" which I suspect will be of interest to a few Stack Overflow'rs if I ever get it done. I'm hosting it on my C# in Depth site, which is vanilla ASP.NET 3.5 (i.e. not MVC). The flow is very simple: If a user enters the app with a URL which doesn't specify all the parameters (or if an...

How-To Mock WCF Services ?

How-to Mock WCF Services Proxies with Rhino Mocks ? ...

Specify XBAP at runtime, in my .NET WPF application?

Can I host an XBAP in my WPF application dynamically? Can I download an XBAP, set it to be hosted in my WPF application, and interact with it programatically? ...

Highlighted squares on a CustomControl chessboard don't persist beyond the initial MouseDown event

I've been coding a Windows app chess game in C# as an exercise in honing my skills, and also because it's fun. I have included functionality that allows a player to select the option to highlight the squares a piece can legally move to when it gets clicked. A CustomControl handles the rendering of the chessboard and it also highlights th...

Capturing the image of a web page using Firefox and Safari

I have a utility that I put together that uses the .NET Framework to capture an image of a web page so that I can use the thumbnail image to preview a page. There are sites which offer this service like websnapr.com, kwiboo.com and shrinktheweb.com. I would like to instead do it myself and leverage Firefox (Gecko) and Safari (WebKit) to ...

is it possible to do inline function in vb.net?

the question is in the title ...

Best database independent SQL DDL utility?

I'm working on a project for the .net platform and would like to support multiple database types. I would like to keep the DDL under source control in a generic format then convert it to database specific DDL for deployment. So I'm looking for utilities that will convert generic DDL into database specific DDL. Ideally it would support M...

Keep WCF Service Connected

Hi, How can I keep my WCF Service Client Connected with WinForm even if a Faulted State appened ? Thanks. ...

dotfuscator slowing up execution speed?

I just found out that my program is losing 5% execution speed when it go through dotfuscator community edition. is that normal? what could be an alternative(free) to dotfuscator that wouldn't do that? ...

How do I configure ASP.net MVC to Scaffold using ADO.net dataservice??

Setting up ASP.net MVC with Linq2SQL or Entity Framework's context to have scaffolding work out of the box is extremely easy. What tweaks would you make to make it work with ADO.net Data Services? ...

Correct use of Lambda query.

Consider the following code: private static void WriteProcesses(StreamWriter sw, DateTime d) { sw.WriteLine("List of processes @ " + d.ToString()); Process[] localAll = Process.GetProcesses().Where(o => o.ProcessName.ToLower() != "svchost"); if(localAll.Length > 0) { ...

Do you prefer C# or Visual Basic .Net?

What do you see as benefits for one over the other? As far as I know, it's just preference. I have way more experience with C# than I do with Visual Basic and was wondering if I should dabble in Visual Basic for certain types of projects? ...

Is .NET included in Windows 7?

Is the .NET Framework included in Windows 7? If so, which version? ...

get Image object from path name

given a path and filename how go i get the image object Image image = ...(filename) ...

WPF - How do determine the index of the current item in a listbox from button handler.

Hi, i have a listbox with a data template that contains a button. When the button is clicked I want to get in the button click handler the index of the listbox item that was current?? How do I do this please? Malcolm ...

WPF - Implementing a listbox that allows the items to be moved up and down.

Hi, This is related to my last post. i want to have up and down buttons on listbox items so that they can moved up/down ie changed its index in the list. Any ideas how I would actualy do this? Malcolm ...

Animate a StackPanel when the property Visibility changes

In WPF 3.5 (with SP1), I have simply StackPanel that I would like to animate when I change the property Visibility. I have no idea of the height of this StackPanel since its content determines its height. So when I change the property of my StackPanel to Visible (progressPanel.Visibility = Visibility.Visible;) I would like to see an anim...