.net

Application Configuration File Not Being Read When Application Called via ShellExecute

Hi, I have a .NET application that is launched via a Delphi program using ShellExecute. Unfortunately when launched in this manner, the application does not seem to be reading its app.config file correctly, as if the file did not exist. I have tried testing the application in other scenarios, e.g. calling from a shortcut with the the w...

IIS Settings for using HTTPRuntime.Cache

I use HTTPRuntime.Cache in my WCF service. It works locally (I mean "localhost:1234", not in IIS). But it doesnt work at server IIS. Is there any settings to do in IIS? The code in my method is like: var response = (Response<CommonListObjects>) HttpRuntime.Cache.Get("commonObjects"); if (response!=null) { return response; } var se...

How do I solve an AntiForgeryToken exception that occurs after an iisreset in my ASP.Net MVC app?

I’m having problems with the AntiForgeryToken in ASP.Net MVC. If I do an iisreset on my web server and a user continues with their session they get bounced to a login page. Not terrible but then the AntiForgery token blows up and the only way to get going again is to blow away the cookie on the browser. With the beta version of versio...

How do I check for a 32-bit z-buffer using Managed Direct3D?

I understand that a call to Manager::CheckDepthStencilMatch should get me an answer, but so far I have not been able to gather the pieces required to make this call effectively. In particular, I need to obtain values for the adapterFormat and renderTargetFormat arguments. I am not specifying any particular format while creating the devi...

Create csv file as a StreamReader on the fly

Hi I would like to unit test the following method public IEnumerable<T> GetData<T>(StreamReader fileStream) where T : new() The streamreader needs to be a file in CSV format, with particular column names. Is it possible to create such files in code, rather than having to have lots of them on the file system for each unit test? Any ...

How do I safely use ADO.NET IDbConnection and IDbCommand to execute multiple database commands concurrently?

The Goal Use an ADO.NET IDbConnection and IDbCommand to execute multiple commands at the same time, against the same database, given that the ADO.NET implementation is specified at runtime. Investigation The MSDN Documentation for IDbConnection does not specify any threading limitations. The SqlConnection page has the standard disclai...

C# Ambiguous calls - Different return type

Hello, I have 2 extension methods that convert a MongoDB document to an entity/object. public static ProductTemplate Convert(this Document document) { return null; } public static Product Convert(this Document document) { return null; } This gives an expected ambiguous call error so I was wondering how I could fix this? Fri...

MySql multiple selects batching in .net

I have a situation in my application. For each x-axis point in my chart, I am plotting 5 y-axis values. To calculate each of these 5 values, I need to make 4 different queries. Ie, for each x-axis point I need to fire 20 sql queries. Now, I need to plot 40 such points in the my chart. Its resulting in a pathetic performance where it ta...

.NET ICustomDoc interface - AxWebBrowser Control

I'm trying to access my codebase with the COM AxWebBrowser control. In the .NET WebBrowser control you can do this with mainWebBrowser.ObjectForScripting = this; In the AxWebBrowser I found this: var cDoc = (ICustomDoc)this; cDoc.SetUIHandler((IDocHostUIHandler)this); However, ICustomDoc is an interface I can't find anywhere. I'v...

How can I get the resolution of an image? (JPEG, GIF, PNG, JPG)

I found this method: Graphics g = e.Graphics; Bitmap bmp = new Bitmap("winter.jpg"); g.DrawImage(bmp, 0, 0); Console.WriteLine("Screen resolution: " + g.DpiX + "DPI"); Console.WriteLine("Image resolution: " + bmp.HorizontalResolution + "DPI"); Console.WriteLine("Image Width: " + bmp.Width); Console.WriteLine("Image Height: " + bmp.Heigh...

How can I get the listening address/port of a WCF service?

I have a WCF service listening on a dynamic allocated port in windows Service Registry. How can i find the listening address of this service from another c# application? Or at least the port of this service? Thanks, Adriana ...

Is there no way to extend ASP.Net Forms Authentication so that sessions can extend past an iisreset?

I just got pinged on another post because my application doesn't keep the user logged in after an iisreset. http://stackoverflow.com/questions/2206595/how-do-i-solve-an-antiforgerytoken-exception-that-occurs-after-an-iisreset-in-my/2206609#2206609 I have to say I agree with the commenter that it is an artificial restriction. From what...

Empty replacement result, when regex doesnt match

Regex.Replace("some big text", "^.+(big).+$", "$1"); // "big" Regex.Replace("some small text", "^.+(big).+$", "$1"); // "some small text", but i need here empty string I need to select a value from the string. It's ok, when the string matches the pattern. But when the string doesn't match, there is an original string in replacement res...

EventHandler and Memory Leaks

I analyze a VB.NET project and there are some objects(child MDI form) that are disposed, but not removed by the GC. The MemoryProfiler analysis find between others the following: "This instance is disposed and still indirectly rooted by an EventHandler. This often indicates that the EventHandler has not been properly remov...

Object Comparison in Unit Testing

I have two objects in my unit test, the actual and expected object. All properties on the object method are the exact same and if I run the following test: Assert.AreEqual( expectedObject.Property1, actualObject.Property1); the result passes as expected. However, when I try to run the following test it fails: Assert.AreEqual (expec...

Create one multipurpose page or individual pages to display item catalog?

Stackoverflowers, I am debating between 2 scenarios for handling the display of a product catalog for a website redesign I am performing. I will be using the IIRF isapi filter to perform the rewriting for an asp.net website. Here is what the urls will look like www.domain.com/catalog/productgroup1 www.domain.com/catalog/productgroup2...

Getting an 'out of memory' exception in this relatively simple program.

Here's my Picture.cs class: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Drawing; namespace SharpLibrary_MediaManager { public class Picture:BaseFile { public int Height { get; set; } public int Width { get; set; } public Image Thumbn...

Does the WebBrowser control in .NET store the previous navigated page?

Does the WebBrowser control in the .NET Framework store the previous navigated page in memory? If it stores the page, I want to delete these pages from memory. How can I do this in C#? ...

C# code generation tool

I'm looking for a tool that can do scripted code generation for me on the .NET platform. ...

Microphone auto level

Hi all! I'm looking for solution to tune mic's level in my VoIP app. I can get a level of sound, but want also tune mic's "volume" when it too low or too high in real-time. Like in Skype... It looks easy ex facte, but I think the algorithm should be a bit smarter then just turning the volume when level comes over hihg/low limits. I'm ...