.net

Extension method for fill rectangular array in C#

I want write extension method for fill multidimensional rectangular array. I know how to do it for the array with a fixed number of measurements: public static void Fill<T>(this T[] source, T value) { for (int i = 0; i < source.Length; i++) source[i] = value; } public static void Fill<T>(this T[,] source, T value) { for ...

You are not authorized to view this page is a dns issue?

I am getting the following error while browsing my asp.net page deployed in IIS: You are not authorized to view this page You do not have permission to view this directory or page using the credentials that you supplied. -------------------------------------------------------------------------------- Please try the following: Contact...

Wrapping a control in a border using styles without overwriting default appearance

What I'm attempting to do is wrap a control in a border without changing it's default appearance, and also without having to create custom controls. I'd like to do the equivalent of this: <Border BorderBrush="Red" BorderThickness="3"> <Button>Hello!</Button> </Border> Just to any control, without actually having to wrap everything ...

Entity framework and deataching objects

When building a web application that uses entity framework in its data access layer, it is recommended to detach objects from the object context to allow objects to be garbage collected. But since the web applications are all request -> response applications, the object context itself is not referenced any more by any live objects afte...

ClickOnce Deployment for different configurations

I'm currently looking at ClickOnce deployment for our WPF application and was wondering, is it possible to set the ProductName and PublishUrl separately for each build configuration in the project file? At the moment I'm having to set these manually in the Publish options, but it could be easy for someone to forget to do this and end u...

You are not authorized to view this page active directory problem

I am getting the following error while browsing my asp.net page deployed in IIS..I am using active directory data retrieval in my website and credentials to the active directory is stored in the web.config file ... You are not authorized to view this page You do not have permission to view this directory or page using the credentials th...

VOIP functionality (real time voice streaming across max of 5 users) over Silverlight 4.0?

As SL 4.0 has got video and Mic support... How feasible it is to provide VOIP functionality (real time voice streaming across max of 5 users) over Silverlight 4.0, for a web based application? What all are the related challenges? ...

GroupPrincipal.Members.Remove() doesn't work with a large AD group

I'm using the System.DirectoryServices.AccountManagement namespace classes to manage the membership of several groups. These groups control the population of our print accounting system and some of them are very large. I'm running into a problem removing any user from one of these large groups. I have a test program that illustrates t...

Why so many individual System.Web.* DLLs?

I've been thinking about ways to refactor a fairly expansive class/utility library I have, and one thing I think I want to do is split off any higher-level helper utilities that introduce new dependencies. I read some previous questions here, and one that I particularly noticed was a comment about how Microsoft freely uses namespaces acr...

Getting Error "Cannot start more than one local run" in Unit Tests in Visual Studio

I am executing a Test to Automatically start my Windows Application. To lauch the Windows Application; the Code used is "Application.Run(Client.MainForm.GetInstance())";. The Debug point comes out of this piece of Code only after i close the Windows Application. I cannot run any other tests until then. If i try to do so; Visual Studio t...

DataTable in T4 template

I'm creating a t4 template that will generate an enum from a number of values in our database. The weird thing is that as soon as I try to create a DataTable in the template code i get the ErrorGeneratingOutput message: <#@ template language="C#v3.5" debug="True" #> <#@ output extension="CS" #> <#@ assembly name="System.Data" #> <#@ as...

.Net Remoting: Wrap user objects vs more remoting channels

I'm learning about remoting by doing small remoting-based projects and also trying to enforce Good Practices while doing so to avoid my usual habit of developing Bad Habits. There is a service that makes use of user-created plugins. Each plugin is isolated in its own appdomain. Additionally, there is a client application that connects...

How do I receive mouse move events while showing a ContextMenuStrip?

I'm using a ContextMenuStrip to show some options to the user when they mouse over cells in a table, by calling its Show(Control, int, int) method from within a the table's MouseMove event, passing the table in as the Control parameter. If the app isn't active, everything works as intended; but if the app is active, then the MouseMove e...

Recommended approach for linq to sql serialization for simple json and mvc

I have cascading drop down lists in a .net mvc view and am using JQuery onchange to pull the next drop down list using a json response. The problem comes in where iI get a circular reference when trying to serialize the linq to sql response. I understand why it is happening, its because I have the buyer -> contracts and contract -> b...

.net, UserControls, and application start time

We have a medium sized application that depends on several usercontrols, namely: A tablelayout panel, with 2x5 grid of usercontrols, with 3+ levels of inheritance. A big issue we're running into with our application has proven to be startup time (both cold\warm), one of the big big hangups we're getting is initializing this usercontrol...

C# Resized images have black borders.

I have a problem with image scaling in .NET. I use the standard Graphics type to resize images like in this example: public static Image Scale(Image sourceImage, int destWidth, int destHeight) { Bitmap toReturn = new Bitmap(sourceImage, destWidth, destHeight); toReturn.SetResolution(sourceImage.HorizontalResolution, sou...

Can you add security to an entity Property with RIA Services?

RIA services allows you to add an attribute to a domain service method like: RequiresRole("Admin"). This will automatically check if the user calling that method has the correct security to do so. I would like to do something similar for a property on an entity. For example, only users in the role "Manager" are allowed to change the "...

spring.net validation

Hi, I'm trying to use the Spring.net framework for the first time. I would like to use its validation capabilities. I'm currently trying to validate business objects, so I have defined several validators (in the App config file). I retrieve these validators through the IOC (ContextRegistry.GetContext().GetObject(validator name)). I woul...

Analysis Services Real Time Trace Logs

I'm looking to get the trace logs for AS (same stuff as for SQL server) in real time. I can't find any .net interfaces to this stuff. So far the only realistic solution I can think of is to run it permanently and have it dump to a new table which I listen to on updates via triggers. Does anyone know of a better way of doing this? This ...

Using DLLImport with an output char[] containing null characters

I am writing a c# app using .NET 2.0. I need to use an old library for proprietary compression. I don't have source code for the library, and the developers behind it are long gone. My problem is that the resulting char[] contains nulls, and is being truncated. Here is the declaration for the function: [DLLImport("foo.dll")] public sta...