.net

What is the difference between i++ and ++i?

Possible Duplicate: In C# what is the difference between myInt++ and ++myInt? Duplicate: In C# what is the difference between myInt++ and ++myInt? In .NET, please. Update: can anyone post a sample scenario of which to use, because both looks very similar to me. ...

how do I download a large file (via HTTP) in .NET

I need to download a LARGE file (2GB) over HTTP in a C# console app. Problem is, after about 1.2GB, the app runs out of memory. Here's the code I'm using: WebClient request = new WebClient(); request.Credentials = new NetworkCredential(username, password); byte[] fileData = request.DownloadData(baseURL + fName); As you can see... I'm...

How do you store images for asp.net application?

We are just upgrading our ASP.Net shop implementation (from simple one) to structure that should be more flexible. I am just looking for some options how to store images related to product. (there will be two types of images, thumb of the product and then full view images of the product). It should handle at least hundred products. So f...

Customizing app.config

I'd like to be able to extend ConfigurationManager so that I have an app.config some like the following: <configuration> <databases> <add name="db1" server="someServer" dbName="superDB" userName="" password=""/> <add name="db2" server="anotherServer" dbName="ordinaryDB" userName="dba" password="dba"/> </databases> </configurat...

Optimizing SQL connection performance?

This is not a question about optimizing a SQL command. I'm wondering what ways there are to ensure that a SQL connection is kept open and ready to handle a command as efficiently as possible. What I'm seeing right now is I can execute a SQL command and that command will take ~1s, additional executions will take ~300ms. This is after t...

Detecting remote DHCP servers in .NET

Using Hyper-V I built a private windows domain which is fenced off from our main network. Ultimately I want to provision this domain for others to use for dev and test, so they can be domain admin. The domain controller is running the dhcp service (other systems in my domain have dependencies on dhcp). The problem is, if some idiot (i....

Advanced SAX Parser in C#.

See Below is the XML Arch. I want to display it in row / column wize. What I need is I need to convert this xml file to Hashtable like, {"form" : {"attrs" : { "string" : " Partners" } {"child1": { "group" : { "attrs" : { "col" : "6", "colspan":"1" } } { "child1": { "field" : { "attrs" : { "nam...

Is there a way in Visual Stuio's compilation settings to combine other referenced DLLs into the built assembly?

I have an EXE that I want to distribute, but I don't want to ship all the associated DLLs with it (sort of). Currently I package them all together using .NET Reactor. I tried ILMerge a while back to achieve the same, but when I tried it I ran into trouble - .NET Reactor has never, ever failed me. Is there a way to achieve this in the ...

API for changing Internet Explorer settings (specifically "Allow mixed content")

We use Selenium to automate some tests on servers we have complete control of. I'd like to find a way to programmatically always allow mixed (SSL and non-SSL) content in web pages in IE, without IE prompting. Is there an API for changing explorer settings beyond things like proxies? I certainly don't mind if it uses platform APIs via P/...

VB.Net 3.5 Check if file is in use

I have an update program that is completely independent of my main application. I run the update.exe to update the app.exe. To check to see if the file is in use, I move it to another file and catch an error if it is in use. If no problems occurr I rename it back. At least that was my plan... Main program: app.exe Update program: ...

Forcing a .Net Windows service to run as 32-bit on a 64-bit machine

I've been given a windows service which references a COM component that only runs on 32-bit. My machine is x64, so the service tries to start, fails to create the COM component, and dies. I don't have the source, just the .exe file. Is there any way to force a service to start in 32-bit mode on a win64 machine? ...

Can't catch exceptions from my class library

I have made a class library in .NET 3.5. My goal is to use it in existing webservices made with .NET 2.0. I have a lot of exception handling in the webservice project but if an exception occurs in my classlibrary my handlers doesn't catch them and the calling method just exits! When in "white coat" environment (read visual studio - deb...

Calling a method for a user control in a repeater?

I have a user control that when a method is called dynamically adds images to an asp panel. I have placed this control in a repeater. I am using the following code to call the function. I have tried calling this function on page_load, databinding of the repeater, databinding of the item, and oninit. foreach (RepeaterItem repit in r...

Can't update items in parent page using loaded child page.

Hey guys, this is more something like "what to do?" than a question in fact... here it is: I have a page in which users can execute selected services.. each of these services are different full .aspx pages (there's a lot of them). the page is divided in 3 sections, as you can see in the picture: Panel A: lists the selected services...

WCF endpoint: Message.WriteMessage changes the closing tags inside the XML message

I am using a custom endpoint behavior extension to intercept messages as they are received by my WCF service endpoint, using IDispatchMessageInspector. I retrieve the message content like this: public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { MessageBuffer messageBuff...

Translate this SQL Query in LINQ to SQL

How can I write a query similar to this one in LINQ to SQL SELECT Id, (Distance - someValue) as Res FROM Table WHERE Res < someOtherValue ORDER BY Res ...

Problem with retrieving XML via HTTP and writing to file

Hi guys, I've written a small scraper that is meant to open up a connection to a PHP script on a remote server via HTTP and pump some XML it finds there into a local file. Not exactly rocket science, I know. The code below is the scraper in its entirety (cleaned up and anonymized). This code works fine except for one small detail, i...

In an IDisposable pattern should a base class allow derived classes to share its disposed flag?

I am currently working on fixing a c# codebase which does not have a good pattern of Dispose usage. It is a large codebase, it is a resource demanding codebase and it uses many custom unmanaged c++ libraries at the low level. I have a good understanding of the dispose pattern. I have spent some time understanding what I believe to be ...

Rotate Hue using ImageAttributes in C#

How can I rotate the hue of an image using GDI+'s ImageAttributes (and presumably ColorMatrix)? Note that I want to rotate the hue, not tint the image. EDIT: By rotating the hue, I mean that each color in the image should be shifted to a different color, as opposed to making the entire image a shade of one color. For example, Origina...

Localization of attribute values in .NET

How can I localize/internationalize attribute values in .NET? My specific example is for ASP.NET web parts such as WebDisplayName, WebDescription, etc. where I inherit from the base class that uses these attributes. Also, is there any difference to doing this with attributes declared in my own classes? Thanks! ...