.net

Why can't this file be deleted after using C1ZipFile?

The following code gives me a System.IO.IOException with the message 'The process cannot access the file'. private void UnPackLegacyStats() { DirectoryInfo oDirectory; XmlDocument oStatsXml; //Get the directory oDirectory = new DirectoryInfo(msLegacyStatZipsPath); //Check if the directory exists if (oDirectory.Exists) { ...

Play PCM data in .NET Framework 2?

I have a stream of u-Law compressed PCM data I am extracting from a Camera, I need to play this out the speakers? Anybody know how? I've tried decoding the u-Law into normal WAV Data and then use SoundPlayer but it never seems to work! Always SoundPlayer only supports PCM Data? I know the sounds ok, because I have saved it to a file ...

Is Response.End() considered harmful ?

This KB Article says that ASP.NET's Response.End() aborts a thread. Reflector shows that it looks like this: public void End() { if (this._context.IsInCancellablePeriod) { InternalSecurityPermissions.ControlThread.Assert(); Thread.CurrentThread.Abort(new HttpApplication.CancelModuleException(false)); } ...

deep zoom image size issue

Hello everyone, My question is from the below MSDN link about deep zoom, When ViewportWidth is 1, it means the picture is never zoomed in and never zoomed out, and displayed at its original size (original size I mean the width and height defined in picture header), correct? 2. My confusion is, when we use deep zoom composer, the tota...

Single objects still limited to 2 GB in size in CLR 4.0?

As I understand it there's a 2 GB limit on single instances in .NET. I haven't paid a lot of attention to that since I have mainly worked on 32 bit OS so far. On 32 but it is more or less an artificial limitation anyway. However, I was quite surprised to learn that this limitation also applies on 64 bit .NET. Since collections such as L...

Why does a tcp remoting client needs to listen?

When a remoting client creates a TcpClientChannel object, it listens on an (unspecified) port. What for? A single tcp connection to the server is already a full duplex, so why listen? ...

Vb.Net String Manipulation & or +

I just had a simple question, but I cannot seem to find a straightforward answer. I've been wondering this for a while, though. I have seen several programmers use & and + for string manipulation. Such as: dim firstvar as string dim secondvar as string dim thirdvar as string thirdvar = firstvar & secondvar Or is it: thirdvar = ...

Isolate a specific thread to run in medium trust

I'm writing a .net win app that loads foreign assemblies and executes third party scripts. I am looking for a way to sanitize the code executed by the foreign script, and only allow the third party scripts access to a defined set of websites. Creating a PermissionSet with its state set to none, and then adding the desired websites, and s...

ASP.NET 2.0 Compilation Error: Make sure that the class defined in this code file matches the 'inherits' attribute

Okay I'm completely stuck on this compilation error. It's a Web Site (not web app), .NET 2.0. I have a file in this directory: welcome_teams file name: default.aspx Page Declaration: <%@ Page Language="C#" MasterPageFile="~/masters/Site.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="welcome_teams_default" %>...

Develop in .Net to Palm OS

Hello, It's possible to develop in .Net to build apps to a Palm OS device like a Palm T|X, because i'm a Visual Basic developer, not a .Net, but i'm studing to develop in .Net, because is a better language, but i'm using the Handheld Basic ++ and the NSBasic to develop for my Palm, but if i can develop in .Net it will be better, but if ...

C# Indexer Property Question

I have a class like this: public class SomeClass { private const string sessionKey = "__Privileges"; public Dictionary<int, Privilege> Privileges { get { if (Session[sessionKey] == null) { Session[sessionKey] = new Dictionary<int, Privilege>(); } ...

Detection of connection and speed of Cellular Network vs. 802.11 and Ethernet? C# .Net

I am working on a program which will be used on mobile devices (Full Windows install) that may have 3G connectivity. If the particular device does have 3G connectivity, we would like to take advantage of it. However, the program should be able to prioritize communication based on what type of connection and speed are currently availabl...

ASP.Net: List of Object in httpcontext.current.cache

Is there a way to look through the cache for all objects in the cache? I'm dynamically creating objects and I need to periodically go through the list to purge out objects I'm no longer using. ...

How to programmatically discover mapped network drives on system and their server names?

I'm trying to find out how to programmatically (I'm using C#) determine the name (or i.p.) of servers to which my workstation has current maps. In other words, at some point in Windows Explorer I mapped a network drive to a drive letter (or used "net use w: " to map it). I know how to get the network drives on the system: DriveInfo[] ...

connecting managed event source to an unmanaged event sink

I'm trying to write a managed library in C# that will act as an event source for an existing C++ event sink. The problem I'm having is that when the unmanaged app calls AtlAdvise to get the connection point map for my library it is getting the error "0x80040200" (CONNECT_E_NOCONNECTION) - There are a couple of MSDN articles about that er...

In .NET/C# test if user is an administrative user

Is there a canonical way to test to see if a user has administrative privileges on a machine? I'm going to be starting a long running process, and much later in the process' lifetime it's going to attempt some things that require admin privileges. I'd like to be able to test up front if the user has those rights rather than later on....

.NET HashTable Vs Dictionary - Can the Dictionary be as fast?

I am trying to figure out when and why to use a Dictionary or a HashTable. I have done a bit of a search on here and have found people talking about the generic advantages of the Dictionary which I totally agree with, which leads the boxing and unboxing advantage for a slight performance gain. But I have also read the Dictionary will n...

.NET compression of XML to store in SQL Server database

Hi all, Currently our .NET application constructs XML data in memory that we persist to a SQL Server database. The XElement object is converted to a string using ToString() and then stored in a varchar(MAX) column in the DB. We dind't want to use the SQL XML datatype as we didn't need any validation and SQL doesn't need to query the XML...

WCF trace file keeps getting corrupted?

I enabled message tracing on a WCF service. it traces a couple of messages and then it stops, when I try to open the trace in TraceViwer it gives me an error on the last message that got logged, or doesn't even open the file duo to different error everytime. I can't even delete the corrupt file unless i run a resetiis since the file is ...

Memory leak in Mixed Mode C++/CLR application

I'm having problems with a slow memory leak in my mixed mode C++/CLR .NET application. (It's C++ native static libraries linked into a VS2008 C++/CLR Windows Forms app with the "/clr" compiler setting) Typical behaviour: app starts using 30 MB (private memory). Then leaks memory slowish, say a MB every hour when running under simulated...