.net-3.5

Server.UrlEncode is not working for " * " ASP.net 3.5

Why? Server.UrlEncode("2*") return 2* while it should return 2%2A as tested on this demo site ...

Whats the difference between <RequiredTargetFramework> and <targetframeworkversion>?

We upgraded our .net 3.5 projects (c#) to .net 4.0. When you look at the project file there are two tags that I'm trying to make sense out of: <RequiredTargetFramework>3.5</RequiredTargetFramework> <TargetFrameworkVersion>4.0</TargetFrameworkVersion> Why are there two seemingly similar tags with different values? ...

Slice Image into random sizes using C#?

I have been asked to come up with a way to slice an image into random sizes. Does anyone know where I would start with a project like this? I looked into the Bitmap.Clone and think this may work. I need to figure out how to get the entire image size and then randomly specify tiles of different sizes for the image size total. Any thoughts...

How to cache XML url?

I am retrieving an XML string through a URL. My code works great, but I do not know how to add caching to it. I am not sure if I am able to cache XML streams or if that is even the right approach. What is the best way to add caching here? XmlTextReader xmlTextReader = new XmlTextReader(this.RssUrl); XmlDataDocument xdoc1 = new XmlDataDo...

Gridview row throwing an error

Lets start by saying that I am debugging someone else's code :-) The error occurs at the code routine that is attempting to export data from a gridview to an excel file. GridView gv = new GridView(); Table table = new Table(); int maxRow = 60000; int gvrow = Data().Tables[0].Rows.Count; The error is occuring at Data().Tables[0].Rows...

"Compatibility Pack" for backporting new .NET Framework features?

For various reasons I often find it desirable to write code that is compatible with .NET framework 2.0 or 3.5 or compatible with the .NET Compact Framework, but it is a problem that there are numerous "small" features in new .NET frameworks that are not available in the older frameworks or Compact Framework. For example, I find extensio...

Get table values in a collection for the same value in any one row using LINQ

I have a table with column having multiple identical values which associates with other row values. ID HValue Limit 0005 0 350.00 0005 1 0.00 0005 2 350.00 0005 3 350.00 0025 0 20.00 0025 1 0.00 I executed the stored proc and stored t...

Why does Windows Media Player sometimes fail to include the appropriate cookies in requests for content when it is being used via Internet Explorer?

We have a site hosted in IIS6 that we built using the .NET 1.1 Framework. Users who go to this site use Internet Explorer exclusively and log into it using Forms authentication. Within the site, users can navigate to a specific page that has an iFrame embedded in it. This iFrame points to another virtual directory hosted on the same serv...

Is it possible to serialize a .NET object in XML without the type as the element root?

Suppose I have a collection in a class that I'd like to have serialized to XML: [Serializable] public class DriveReport : IXmlSerializable { public int Capacity { get; set; } public int FreeSpace { get; set; } public char DriveLetter { get; set; } //Assume that the appropriate IXMLSerializable methods are here, where //t...

Is there a lot of overhead in a User Control?

I am working on a WinForms project which feels sluggish. It is composed of a literally hundreds of User Controls. If there is a piece of a UI functionality (even if not used anywhere else in the app), it's encapsulated in a User Control. I've gone through the project a number of times with the ANTS profiler and most of the heavy code a...

How does one "disable" a button in WPF using the MVVM pattern?

I'm trying to get a grasp on WPF and MVVM and have been making good progress. The WPF and MVVM side of things are going well. However, the XAML and data binding side is a whole other story :) How would I go about "disabling" a button? For example, I have a CanClose property in my view model that determines whether or not the applicati...

A more efficient way to manage IEnumerable.GroupBy()

This is a segue to my previous question: http://stackoverflow.com/questions/3141285/looking-for-a-better-way-to-sort-my-listt Basically, I have a similar situation where I need to do a .GroupBy() on about 40 different fields. The original code would have used a giant switch statement, but I'd like to know if there's a better way to th...

Can this code be refactored by using the reactive framework ?

Hi all, copy paste the following code in new C# console app. class Program { static void Main(string[] args) { var enumerator = new QueuedEnumerator<long>(); var listenerWaitHandle = Listener(enumerator); Publisher(enumerator); listenerWaitHandle.WaitOne(); } private static AutoResetEve...

Named Pipe Server throws UnauthorizedAccessException when creating a seccond instance if PipeSecurity is set.

I am trying to write a (elevated privilege) service that will talk to a non privileged winforms application. I was able to have two console applications (one elevated one not) talk back and forth no problem but I am having a problem doing a service and a winforms app. The first instance of the pipe works perfectly. However after my clie...

how threads communicate with eachother?

how threads communicate with eachother? they dont use values of eachother, then what is the way of communication between them? ...

Trouble with ASP.NET HttpWebRequest POST to a site

ASP.NET 4.0 Need some help with this vexing HTTP POST problem - I have looked at other posts on Stackoverflow but to no avail. Problem summary: It's a classic case - I want to login to an external site which takes 2 parameters to login, and I need to use a POST to do it What happens: I do a POST and the HTTP response that comes back ...

C# : Obscure object ref error

Hi, Have an app which has been running fine for a while. All of a sudden it has started throwing intermitent "Object reference not set...." errors at a certain line of code on the product server. I started the app in Visual Studio and debugged it with a breakpoint at the offending line of code and have replicated a really strange beha...

Get Database's Tables

Hi I want to write a query to get the names of tables of a specific database, but I don't know how can write it. I want to execute this query for MS Access 2007 and Oracle 11g. Thanks ...

How do I pass information from a ThreadPool.QueueUserWorkItem back to the UI thread?

I have a rather simple threading question. I'm writing a simple utility that will run various SQL scripts based on parameters defined by the user. In order to keep the UI responsive and provide feedback as to the status of the scripts that are being executed, I've decided that using ThreadPool.QueueUserWorkItem would be appropriate to ...

use parametric function in thread in C#

hi this is my multi thread codes it works fine using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; using System.Threading; namespace searchIpAdresses { public partial class frmSearchI...