.net

c# make square image

Hi How to resample an image to square, padding with white background in c# preferable without using any 3rd party libraries (.Net framework only)? Thanks! ...

OutOfMemoryError calling XmlSerializer.Deserialize() - not related to XML size!

This is a really crazy bug. The following is throwing an OutOfMemoryException, for XML snippits that are very short and simple (e.g., <ABC def='123'/>): public static T DeserializeXmlNode<T>(XmlNode node) { try { return (T)new XmlSerializer(typeof(T)) .Deserialize(new XmlNodeReader(node)); } catch (Ex...

Why does IHttpAsyncHandler leak memory under load?

I have noticed that the .NET IHttpAsyncHandler (and the IHttpHandler, to a lesser degree) leak memory when subjected to concurrent web requests. In my tests, the Visual Studio web server (Cassini) jumps from 6MB memory to over 100MB, and once the test is finished, none of it is reclaimed. The problem can be reproduced easily. Create a ...

How to block the possibility to add the same record to a SPList?

Hi, Is there a possibility to block chance to add the same data to SPList? I know that two records always are different regarding the ID field. I would like to validate other custom fields added previously by me, and don't allow of adding same field's value. Can anybody tell me how to implement this? I can guess that event receivers cou...

Troubleshooting .NET "Fatal Execution Engine Error"

Summary: I periodically get a .NET Fatal Execution Engine Error on an application which I cannot seem to debug. The dialog that comes up only offers to close the program or send information about the error to Microsoft. I've tried looking at the more detailed information but I don't know how to make use of it. Error: The error is visi...

Top caching libraries for .NET

What caching libraries would you consider to be the most important or useful for .NET? I'm asking because I need to contact them to see they plan on supporting .NET 4.0's caching framework. ...

Why does IIS use so much more RAM than WebDev (ASP.NET development web server)?

As I was investigating excessive memory usage problems in my ASP.NET application I noticed that the production server seems to use a lot more RAM than my development machine for the exact same input. It turned out to be the difference between IIS (w3wp.exe) and WebDev.WebServer.EXE. I ran the same test on my machine in IIS and WebDev wit...

SQL - .NET - SqlParameters - AddWithValue - Are there any negative performance implications when Param Type is not specified?

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparametercollection.addwithvalue.aspx I'm used to adding sql parameters to a sqlCommand using the add() function. This allows me to specify the type of the sqlParameter, but it requires another line to set the value. It's nice to use the AddWithValue function, but it ski...

Bad crypto error in .NET 4.0

Today I moved my web application to .net 4.0 and Forms Auth just stopped working. After several hours of digging into my SqlMembershipProvider (simplified version of built-in SqlMembershipProvider), I found that HMACSHA256 hash is not consistent. This is the encryption method: internal string EncodePassword(string pass, int passwordForm...

Programmatically choosing image conversion format to JPEG or PNG for Silverlight display

I have a project where I need to convert a large number of image types to be displayable in a Silverlight app - TIFF, GIF, WMF, EMF, BMP, DIB, etc. I can do these conversions on the server before hydrating the Silverlight app. However, I'm not sure when I should choose to convert to which format, either JPG or PNG. Is there some kind of...

Is it possible to expose an API for my own WebSite ... but use oAuth for the api authentication?

Hi Folks, currently I expose an Api for my website. Works great .. and i use Basic Authentication to authenticate users to get access to the data. eg. http://www.MyWebSite.com <-- main site. http://api.MyWebSite.com <-- my api website. sample api RESTful url http://user1:[email protected]/games?type=battlefield2 (yes yes...

How can I script the deployment of a Visual Studio database project?

How can I script the deployment of a Visual Studio database project? I have a DB project in visual studio and I would like to use it in order to deploy on remote machines via a script. I notice that when I 'deploy' from visual studio, it generates a .sql file. I intercepted this file and tried running it from the command line with osq...

Progressively stream the output of an ASP.NET page - or render a page outside of an HTTP request

I have an ASP.NET 2.0 page with many repeating blocks, including a third-party server-side control (so it's not just plain HTML). Each is quite expensive to generate, in terms of both CPU and RAM. I'm currently using a standard Repeater control for this. There are two problems with this simple approach: The entire page must be rendere...

How do I avoid web method parameters using proxy classes?

I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A. It's used in a parameter for a web service defined in project B: public XmlDocument CreateNewClient(ClientInfo ci, string system) I now wish to call this web method from project C and use the original DataUnification.ClientData....

Is it possible to inspect an assembly's IL instructions programmatically using managed code?

See title. Reflection.Emit seems to be more about creating a new dynamic assembly, not for loading an exisitng assembly and inspecting its IL. ...

Is there an easier way of creating a registry volatile subkey in .net?

So far I have the below which is taken from http://www.danielmoth.com/Blog/volatile-registrykey.aspx public static class RegistryHelper { public static RegistryKey CreateVolatileSubKey(RegistryKey rk, string subkey, RegistryKeyPermissionCheck permissionCheck) { var rk2 = rk.GetType(); const BindingFlags bfStati...

How to determine if object in another AppDomain has gone

I instantiate an object of some class in other ApDomain using CreateInstanceAndUnwrap(). I can determine if this object resides in other domain by using RemotingServices.IsTransparentProxy(). But can I determine if the real remote object has gone away (e.g. was garbage collected) without probing a call on proxy and catching RemotingExcep...

NHibernate BusinessRules

I need implement business using nhibernate ORM I have two entites Project (Id,Name,Effort) Task (Id,Name,Effort) I need update Effort in Project when Effort in Task changes. How to do it ? I have planed to use event system build in nhibernate but still don't know how to access to Project entity within Task Event Here is EventListene...

JumpList and ClickOnce - is this combination possible?

I have a WPF application which uses a JumpList (Recent only). Everything works perfectly until I deploy it using ClickOnce - the JumpList simply does not show (BTW, it does not show as well when running under VS debugger. Anybody knows if it is possible to have JumpList working from a ClickOnce deployed app? ...

how to create xps document on the fly?

is there any library about this inside the .net framework? or any other open source? ...