.net

How to modify HTTP responses in a different .NET process

I have a standard web server that serve web pages. I want to monitor traffic on port 80, intercept every http responses, and add/inject an additionnal header to them. The process will then act like a proxy between the web server and the client. Could you please give me some pointers? I'm already aware of SharpPCap, but I'm not sure wh...

Questions about multi-threading

If I have a that thread: Thread sendMessage = new Thread(new ThreadStart(timer.Start())); will, the Tick event of the timer will be on the main thread or on the sendMessage thread? Edit: I have a queue and i want that every x milisecond the timer will tick and the program will dequeue arrays from the queue, but this is my code: Thre...

How can i do transaction between remote services ?

I have to do 2 job which is on remote services not belongs to me.I have to register or upgrade a product on first remote service and i have to get payment via VPOS on second service. Is it possible to make a kind of transaction in this case ? ...

Generated T-SQL from LINQ to SQL performs DATEPART

The following LINQ to SQL query is splitting the date into pieces. It seems odd that a date comparison would use the following generated SQL statement. var customers = (from c in db.customers where c.servhists.Any(sh => sh.donedate.Value.Date >= startDate.Date && sh.donedate.Value.Date <= endDate.Date &...

When to use MessageQueueTransaction for simple cases?

I'm new to MSMQ and trying to understand when to use MessageQueueTransaction class. For example, is there any value to create a simple transaction just for putting a message in the MSMQ queue like this? using (MessageQueueTransaction t = new MessageQueueTransaction()) { t.Begin(); Message m = new Message(myString, formatt...

Query an AD domain via SSL

I have a domain and port number (636) as well as a username and password. I am trying to figure out a way to connect to this AD via Secure LDAP and get a users 'givenname', 'sn', 'mail', and probably a few custom attributes. However I have no idea how to do this in C#. I think that Microsoft may have a method for this available alr...

Linq to SQL - Group By Table

This doesn't work: Dim Qry = From RE In DB.Res_Estab Where _ (RE.Estab_Code = Estab_Code) Group By RE.Research Into Group Select Research Because Research is a table, not a value. It renders the error "A group by expression can only contain non-constant scalars that are comparable by the server." So I'm splitting in two queries: Dim...

Encrypt In .NET / Decrypt in SQL Server

Is there a way to decrypt a column when querying data from a SQL Server (2005/2008) database that has been encrypted using DES via .NET? If so, how? I have the key, but don't know how to use it within the context of a sql server query. ...

Does Streaming a WCF Soap Help the Client Send Using Less Memory?

I have a windows mobile application that sends data via WCF to a server. The data it sends sometimes exceeds the limit on the windows mobile device. I am wondering if streaming would help not need to hold all the data I must send in memory at once. Here is a simple example: [DataContract] public class MainContract { [DataMember] ...

How should I load assemblies across the application domain boundary to load and unload modules?

I'm aware of the limitations of loading an assembly dynamically during run-time that prevents it from being unloaded. Instead it's been suggested that, if this is a requirement, that I should instead load modules in other application domains and then execute code across the domain boundries. How can I ease this development process and ...

Broken sockets in .NET ?!

Here's a really strange problem: Apparently, the specific sequence of bytes which translates to ASCII "PUttttt", if sent over a TCP socket doesn't make it to the client at all. I've included the sample code used to demonstrate the problem below in hopes that someone might have an idea as to why this is happening. The server and client ...

System for language versioning of .NET sites or Apps

Many years ago I build a simple system for handling languageversioning of texts in ASP.classic sites. Since then I have not converted or maintained it, and have been using various sub-optimal solutions (and lets face it, the system was probably not as great as I remember it ;-) What do you use for language versioning texts for your site...

.NET TextBox hangs when updating

I'm trying to prepend a string a read-only, multi-line TextBox using the following code: private void AddText(string text){ // output is a StringBuilder object output.Insert(0, "\r\n"); output.Insert(0, text); this.textBox1.Text = output.ToString(); } The issue is that sometimes the window ends up just hanging there (even whe...

Returning IEnumerable with using

Interesting problem I ran across which makes total sense. I have a generic method like so: public TResult Run<TResult>(Func<SqlDataReader, TResult> resultDelegate) { TResult result; using (SqlDataReader reader = command.ExecuteReader()) // command is SqlCommand with attached SqlConnection { result = resultsDelegate(read...

MongoDB - ASp.net - Questions

Hi, I’am starting a personal web project. Which I hope it grows fast. It will do a lot of text inserts and searches in this project. So it seems MongoDB a good option. But of course there is not a hosting of asp.net and mongoDB. Also I do not want to expend a lot of money, at the beginning. So I have the idea of contract https://mo...

Check if return type is IEnumerable<T>

How can I check if the return type of a function is IEnumerable<T>? In other words, I don't want to match List<T>, even though it implements IEnumerable<T>. Or put even another way, how can I detect if a function has deferred execution? ...

WCF troubleshooting - async and zero results

How do you troubleshoot a WCF Service consumption from the client side (silverlight) when from the server you can tell that you service works (stepping through) and the client gets an ObservableCollection with nothing in it? void client_GetAddressesCompleted(object sender, GetAddressesCompletedEventArgs e) { var x = e.Re...

Padding problem for text email using PadRight in C#

I have a question regarding encoding for text email messages using C# .net because I have mine as simple ASCII but when doing padding for formatting a recipt to the user the data is not lining up although when I check the lines in say NotePad++ they are exactly the same No. of character. Below is some code, can anyone tell me what I'm do...

Silverlight: Adding TabItems to TabControl dynamically with a standard ContentTemplate for all tabs

I would like to add TabItems to a TabControl dynamically with a standard ContentTemplate comprising of a grid and few other input controls like textbox and button. Can someone pls help me achieve this? Also, if I try to load data from a WCF service asynchronously to the grid, there will definitely be a time lag. So how do I exactly bind...

C# POS.NET PrintNormal() Issue 'It is not Initialized'

Hey Now Everybody- Current C# POS.NET Issue: PrintNormal() Throws Exception = 'It is not initialized' CheckHealth = 'It is not initialized' 'It is not initialized' exception when Printing to Epson TM-T88IV Using POS for .NET 1.12 and the Epson OPOS ADK for .NET (v1.11.9) service-objects Successfully able to Open, Claim...