.net

How to serialize on to existing file?

Let say I have a file that contains a serialized object by BinaryFomatter. Now I want to be able to serialize another object and APPEND this on that existing file. How can I do it? ...

Connecting to a .NET webservice via a SOCKS5 proxy

Hi All I'm attempting to connect through a SOCKS5 proxy to a webservice. Currently, my app.config is as follows: <system.net> <defaultProxy enabled="true" > <proxy proxyaddress="http://xxx.xxx.xxx.xxx:yyyy" bypassonlocal="True" /> </defaultProxy> </system.net> This works fine for http proxies, however it just doesn't connect to...

C# IEnumerator/yield structure potentially bad?

Background: I've got a bunch of strings that I'm getting from a database, and I want to return them. Traditionally, it would be something like this: public List<string> GetStuff(string connectionString) { List<string> categoryList = new List<string>(); using (SqlConnection sqlConnection = new SqlConnection(connectionString)) ...

Using NMock with ByRef parameters

I have to work with an API that uses a lot of by-reference parameters. I'm just beginning to use NMock, and I'm having trouble seeing how to make NMock actually modify one of those by-ref parameters to a specific value. Am I missing something, or does it just not do that? Is there a better way, short of wrapping this API? ...

Dynamically Built Regular Expressions are running extremely slow!

I'm generating regular expressions dynamically by running through some xml structure and building up the statement as I shoot through its node types. I'm using this regular expression as part of a Layout type that I defined. I then parse through a text file that has an Id in the beginning of each line. This id points me to a specific lay...

Distributed Storage of BLOBs for .NET?

I am looking for a reasonably well tested library+server to store a persistent distributed hash table. I am hesistant to use SQL-based solutions as the data is highly document oriented, consisting of millions of ~64KB blobs with only a single index (computed by hash of said BLOB) - and needs to be able to be distributed for long term s...

Running a C# exe file

Duplicate: Why does my .NET application crash when run from a network drive? Can someone help me? For a school project, I wrote a C# windows application in Visual Studio 2005. It works just fine, no problems. I want to be able to share this program with others in my department at work. So, I copied the exe file to a network d...

Is there a free .NET obfuscator that supports command-line operation?

Is there a .NET obfuscator that fulfills all of the following requirements? Strict requirements: The obfuscator must be free to use The obfuscator must support command-line operation The obfuscator must itself be written in a .NET language so that it can be run using Mono ...

How can I get the assembly last modified date?

I want to render (for internal debugging/info) the last modified date of an assembly, so I know when was a certain website deployed. Is it possible to get it though reflection? I get the version like this, I'm looking for something similar: Assembly.GetExecutingAssembly().GetName().Version.ToString(); ie: I don't want to open the ph...

Get Directory Structure using Linq?

Hi I have an app where I get a list of drives on the computer and when you select one I populate a tree control with the directories and files. I was thinking of trying this using linq to loop round each directory and get its child directories. Has anyone done anything like this before? Thanks ...

How do I write to a custom Windows event log?

I'm attempting to set up basic logging to the windows event log in .net via System.Diagnostics.EventLog, but I'm failing to see any events actually getting written to the log. Consider the following code: // Elsewhere in the class private static readonly string EventLogName = "LogName"; private static readonly string EventLogSource = "...

How to trigger Google Analytics from code?

My app reads an (html) file from my website, and I would like to track accesses to that file using Google Analytics. As the GA Javascript does not get executed when reading the file, it is not tracked. Is there a way to trigger GA directly from code or alternatively, to execute the Javascript from a .NET app without adding a bunch of dep...

Extra Process file locks

I have a .NET system where I need to allow files to be locked and unlocked across process boundaries. The model I plan to use is this: User generate a lock token Uses Locks a file with token and refreshes token repeat at #2 as needed Uses unlocks all files by releasing token If uses fails to refresh token in some time-frame, #4 happens...

ASP.NET Web Service WebMethod

I have a .asmx web service webmethod that I am successfully calling from jquery.ajax. The webmethod is functioning properly. However, it performs very slowly. The method itself does very little work right now. I have added CacheDuration = 120. That did not help. My real concern is how long it takes to actually call the method. When ...

Is it possible to communicate with an external system over TCP/IP using WCF?

We are building a system that interacts with an external system over TCP/IP using the FIX Protocol. I've used WCF to communicate from client to server, where I had control over both client and server, but never to an external TCP/IP based system. Is this possible with WCF? If so, could the community provide links for me to get started...

Microsoft Sync Framework vs WCF

I have the option of either using WCF or Microsoft Sync Framework for my next project. This will be a SQL Server backend that needs to sync to a mobile (.net cf) front end. I have a few issues, 1. the database schemas between the two databases will not be the same. 2. On the server side I actually need to call a .net dll to do the upda...

System.FormatException: The specified string is not in the form required for an e-mail address.

hi i am using asp.net and xml im making a form tht send an email but it gives me an error the email adresses come from the xml file The specified string is not in the form required for an e-mail address. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for...

Can .NET WebRequest/WebResponse translate accent marks, diacritical marks, and entities correctly?

I am "screen scraping" my own pages as a temporary hack, using .NET's WebRequest. This works well, but accented characters and diacritical characters do not translate correctly. I am wondering if there is a way to make them translate correctly using .NET's many many built in properties and methods. Here is the code I am using to gra...

Safe version of Path.Combine

I have a rootPath that I trust and a relativePath that I don't. I want to combine them in such a way that I can be sure that the result is under rootPath and that the user can't use .. to get back past the starting point. I do want the relative path to allow things like: hello\..\world == world ...

Looking for .NET client library for CheetahMail

We're doing business with Experian CheetahMail as an email service provider (ESP). I'm wondering if anyone has a .NET wrapper for the Cheetah APIs. Thanks! ...