.net

How to share session cookies between Internet Explorer and an ActiveX components hosted in a webpage?

I am currently working on a .Net application which makes HTTP requests to some web applications hosted on a IIS server. The application is deployed through ClickOnce and is working fine on simple networks architectures. One of our customers has a very complex network involving a custom authentication server on which the user has first to...

automapper - how to map object list

Let us say my domain object can contain a bunch of objects like this: List<Thing> Things where Thing is defined like this: class Thing ( public int ThingId { get; set; } public string ThingName { get; set; } ) My DTO contains List<string> ThingIds; List<string> ThingNames; The question is how can I use automapper to map ...

P/Invoke on 32 bit and 64 bit systems

Let us pick the following Win API call as an example: BOOL MessageBeep(UINT uType); // from User32.dll The input parameter is UINT to specify the beep type, which is can be both 32bit and 64bit integer, depending on which Windows version we call it on (or am I wrong?). If I want to P/Invoke message beep from C#, so I apply the DllImp...

Service restarts automatically after it is manually stopped.

I have created a windows service in C#.NET that is continuously running. Now when i stop it from the services.msc initially it shows that it has been stopped but after some time when i refresh the services.msc it shows as started again. I also checked in the task manager at the same time, i see that the exe of my application gets killed ...

NHibernate Native SQL multiple joins

Hi all, I"m having some problems with Nhibernate and native sql. I've got an entity with alot of collections and I am doing an SQL Fulltext search on it. So when returning 100 or so entities, I dont want all collections be lazy loaded. For this I changed my SQL query: SELECT Query.* FROM (SELECT {spr.*}, {adr.*}...

SmtpClient (.NET) does not encode mail header in conformance with RFC 2047

I am using .NET SmtpClient to send e-mail where the subject might contain characters outside of the ASCII range. The RFC 2047 defines how e-mail text should be encoded when it contains special characters. Here is an example of a subject in an e-mail header: Subject: Votre enregistrement numéro 123 This should become, after encoding to...

How to pass Button.Click into a function?

I have a function that adds eventhandlers to control events. Right now I have several overloads that add events to different types of controls: Public Sub AddEventHandler(Button, ButtonEvent) 'adds event handling for Button.Click public Sub AddEventHandler(LinkButton, ButtonEvent)'adds event handling for LinkButton.Click The problem ...

Creating CodeMemberMethod from string

I am trying to generate some code using CodeDom. I wanted to know if there is any way to create CodeMemberMethod from a string. I found a method, but it generates assembly from string. I wanted to generate some methods from string. Is there any way? ...

Implementing Read Only view in Winform App

I have an in house winform app for viewing, editing, and inserting member data. There are about 40 sepertate form pages that they use to manipulate different portions of the data. My question is this; What is the best way of implementing a read only view for a form page? My thoughts were to cycle through the controls setting Enabled ...

What FIX implementation do you recommend for use with .NET

I am reviewing implementation choices for FIX when using .NET. A few obvious choices come to mind, but I want to know if there are other options, better choices or if we've made the same decision as a lot of you. QuickFIX - Stable, C++ implementation - so you've got unmanaged code to interop with. FIX4NET - C# implementation - seems t...

Jmail vs System.Net.Mail

Currently all our projects use jMail. It has been this way since .NET 1.0. Should I start my next project using System.Net.Mail? Are there any advantages that one has over the other or is it just preference? ...

Uploading Large Files

Hello, I'm using a windows service on my server to receive large files (1 GB) from desktop clients when I use the TCPClient class it creates astream to send the file which bloks my memory, What is the well designe for this problem ...

Windows - Named pipes performance recommendations with C#

I am currently evaluating named pipes for IPC on Windows with .NET/C#. I am currently looking at a single producer, single consumer scenario. Are there any good performance consideration guidelines? In my first test case I was comparing the speed of large messages vs small messages and seems to be that large (64k) messages are sent as qu...

Screen information while Windows system is locked (.NET)

We have a nightly process that updates applications on a user's pc, and that requires bringing the application down and back up again (not looking to get into changing that process). The problem is that we are building a Windows AppBar on launch which requires a valid screen, and when the system is locked there isn't one in the Screen c...

How can I start ServerManager.msc on a 64bit Windows Server 2008 from a 32bit .NET App?

Hi I have the following scenario: - 64bit Windows Server 2008. - 32bit .NET application (needs to be x86 for various reasons). - I need to start ServerManager.msc from my .NET application. When using Process.Start("ServerManager.msc"), I get the following exception: System.ComponentModel.Win32Exception. Message="The system cannot find ...

What is the best way to translate a big amount of text data?

I have a lot of text data and want to translate it to different languages. Possible ways I know: Google Translate API Bing Translate API The problem is that all these services have limitations on text length, number of calls etc. which makes them inconveniente in use. What services / ways you could advice to use in this case? ...

RIA Service - without database?

Helo! I need to write a RIA service to call Java webservices from Silverlight 3.0 app. I'm testing how stuff works and in my Web app I have a MyData class which has 2 properties (int ID, string Text): namespace SilverlightApplication1.Web { public class MyData { [Key] public int ID { get; set; } public ...

Can you omit the parenthesis from attributes with no params?

I noticed when I have Serializable instead of Serializable(), the code still compiles. Is there a rule for this that you can omit the parenthesis? Is it a good practice? It seems more readable to me unless I am missing something. ...

Composite key in Dictionary; override GetHashCode(), Equals etc or use structs?

I have quite a few dictionaries where the key is a composite of several different values (mostly strings and integers). Do I implement these keys as classes (and override GetHashCode(), Equals() etc) or do I use struct instead? ReSharper makes it easy to do the overriding, but the code looks horrible. Are there any performance implicat...

Regular Expression - Match only 7 chars?

I'm trying to match a SEDOL (exactly 7 chars: 6 alpha-numeric chars followed by 1 numeric char) My regex ([A-Z0-9]{6})[0-9]{1} matches correctly but strings greater than 7 chars that begin with a valid match also match (if you see what I mean :)). For example: B3KMJP4 matches correctly but so does: B3KMJP4x which shouldn...