.net

Is there a way to grant privileged access to a .NET assembly to only one other assembly?

I have a class library assembly and some test code. Because the test code needs to peek at the internals of the the class, it needs to be part of the assembly and because I don't want to have it run all by it's self, it needs have something public so that a different assembly can invoke it. This ends up tacking on some code that shouldn'...

Web Services for Remote Portlets in C# / .NET -- Options?

I recently had my mind expanded by a new concept: Web Services for Remote Portlets, or WSRP. I learned of it during a presentation on a Java-based web portal we are considering purchasing at work; we are a .NET shop and WSRP would be the means by which we would extend this portal. Although I cannot control the end decision as to whethe...

Parameter is not Valid

When I paste a picturebox that was copied, I get Parameter is not Valid. The Picturebox that was copied has a valid image which displays just fine. The exception is coming from the undo engine of the surface designer. Anyone have any idea whats going on? ...

Running an MVC Application as a Sub-Application?

I'm attempting to create an MVC application as a sub-application to my standard Asp.Net Web application. Both of these projects are inside the same solution. While the parent application appears to be going fine, I'm having trouble getting the sub-application to work. After some massaging of my two web.configs, I was able to get the Asp....

Cancelling Aysnchronous stored procedure

Hello All, I am running a long running stored procedure that user can cancel. I am using Backgroundworker component along with BeginExecuteReader method of ado.net everything seems to work fine, but even when i cancel the stored procedure, the database is still running the proc Is there a way to cancel the actual job on the database ...

Is it better to use WPF over WinForms?

For a brand new application, is it better to use WPF over WinForms? I used WinForms before but not much WPF. AFAIK WPF is the successor to WinForms, right? The application is gonna host DirectX windows (not WPF 3d, but managed dx / slimdx) with lots of custom controls. EDIT: The application is a 3d related application, editor, such as ...

How can I use .NET web services from non-standard ports?

Our web services are accessed through a router which uses port forwarding to connect to the actual web server. When we are trying to establish a web reference in Visual Studio it seems the .NET framework returns the full URL with a port to Visual Studio for the reference during discovery. Visual Studio then tries to make a connection b...

Is there a reason to NOT use .NET Framework-defined exception classes in your own code?

So, we are using the Enterprise Library 4.1 Exception Handling Application Block to deal with logging/handling our exceptions in a multiple-project application. We have a few custom exceptions and are throwing some exceptions whose classes are defined in the .NET framework's standard class libraries (e.g. ArgumentException, InvalidOperat...

.net Batch Printing with WebBrowser Control and Print Dialog.

I'm printing html documents using a .net webbrowser control and I want to be able to show the print dialog once so the user can choose their printer. Is there any way to show a print dialog without showing it every time the webbrowser control prints? Is it possible to use a printdocument and somehow pass it's settings to the webbrowse...

Need an example of a "Good Line of Business Application" for .NET that uses ORM

I'm trying to move toward TDD, ORM, Mocking, ect. I need a good example of a line of business app that uses an ORM preferably NHibernate. It has to be open source and use the repository pattern. I learn best by example, I have played around with the repository pattern and unit of work pattern but not in any meaningful applications. I'...

Can I have a non-mutable IEnumerable<>?

I have code similar to this: class Foo { List<Bar> _myList; ... public IEnumerable<Bar> GetList() { return _myList; } } The result of GetList() should NOT be mutable. To clarify, it is ok if instances of Bar are modified. I simply want to make sure the collection itself is not modified. I'm sure I read an answer somewhere...

Correct value for hWnd parameter of BeginPaint?

I am trying to make a Visual C++ 2008 program that plots some data in a Window. I have read from various places the correct way to do this is to override WndProc. So I made a Windows Forms Application in Visual C++ 2008 Express Edition, and I added this code to Form1.h, but it won't compile: public: [System::Security::Permissions...

Maximum Filesize of LogFileAppender in Log4Net

I am using Log4net for a while now and it's an amazing logging framework, especially when hooked into Castle.Windsor. However... I usually use the rolling file appender, but this has resulted in too many log files than I actually want, so instead, for my latest project, have used the basic LogFileAppender instead, but the problem is th...

WPF Binding - How to determine object is invalid to prevent Save

Hi, I have a textbox in a WPF application bound to a property on a Linq to Entities class that implements IDataErrorInfo. The textbox binding has ValidatesOnExceptions=True and ValidatesOnDataErrors=True. When the textbox is bound to an integer property and the user enters text then the textbox outline displays as red as I haven't set...

Base32 Decoding

I have a base32 string which I need to convert to a byte array. And I'm having trouble finding a conversion method in the .net framework. I can find methods for base64 but not for base32. Convert.FromBase64String – something like this for base32 would be perfect. Is there such a method in the framework or do I have to roll my own? ...

c# reuse event handler good practice

In my current project I am using 4 grid views in different tabs, as the system has developed they have some shared methods such as show a custom tooltip and a right click menu for when on rows. I am now going through a code cleaning exercise, what I see below is I now have 4 event handlers calling the same method, is it ok to change the ...

Multiple Windows Services, One Installer, Removing Dependencies

I have a single service installer project that installs multiple services. This is great but a single unhandled exception in any single service will stop all services that were installed by this installer. The code for the installer looks something like this ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Servi...

Default ContextMenu Style - WPF

I am trying to modify the default style of the ContextMenu in WPF. Normally you can creat a copy of the default in Expression Blend using the Edit Control Parts (Template) > Edit a Copy menu option. However I can't work out how to do this with a ContextMenu. Any idea how I can get the default style to modify? I am trying to disable...

.net HttpHandlers Pass Request Up The Pipeline To IIS6

Is there a way for a Http Handler to pass a request back up the pipeline to IIS 6 and let it handle the request? For example, if I have a Http Handler set for verb="(wildcard)" path="(wildcard).txt" I have a file called myunformated.txt, I would like IIS 6 to send it to the user if it doesn't have querystring params attached. Any Idea...

Can anyone recommend a book for building enterprise database applications in .Net?

I've just returned from a course where we covered some ways to build enterprise applications (including database applications). In short I've realised that the way that we have been building our database applications is completely wrong (I won't go into details). Can anyone recommend a reputable book or website that shows me the "best ...