.net

Examples of SQL injection even when using SQLParameter in .NET?

I heard that SQL Injection can still be possible when using ADO.NET SQLParameter (paramterised query) for SQL Server. I am looking for real examples in C#/VB code as proof. EDIT: I am looking for SPECIFIC working examples. Not introductions to sql injection or how to prevent it. ...

Changing a value in the machine.config

What is the effect of changing a value in the machine.config file? Will this trigger the equivalent of IISReset on the machine? If not, will a running application immediately pick up new values added to this file? ...

Achieving AES-256 Channel Encryption with the .NET Compact Framework

Hi There, I am working on a business application where the clients are Windows Mobile 6.1 Professional devices. The server is a Java enterprise application. The industry working group recommends AES-256 encryption for client/server communications. This is necessary to gain certification. The encryption doesn't necessarily need to be ch...

Will an exception get passed back to the calling method?

Let's say in one method I have try { callme(); } catch { // handle callme exception } Now let's say callme() calls method1() which in turn calls method2() -- If method2() throws an exception should it get thrown back to method1()'s frame, which will then stop any further execution inside of itself and pass the exception thrown from m...

Design/pseudocode for a listen thread in something like XNA?

Hokay so here is what I'm trying to accomplish: I'm going to be sending some mesh data over a network that my render-er (programmed in XNA) must render. For those not familiar, a typical XNA "game" basically runs in a continuous thread... which updates and draws your data. The problem is, I don't want to slow this thread down by havin...

Redirecting native dll stdout/stderr from within C#

Hi... I'm trying to redirect the output of a third-party native dll which outputs to stdout/stderr from within C#. The output of both stdout and stderr should go to a log file. Here's my idea (x2 for two streams): Create an AnonymousPipeServerStream Get the pipe's handle via _outServer.SafePipeHandle.DangerousGetHandle() Use P/Invoke...

bool versus BOOLEAN in managed prototypes

I'm trying to create a managed prototype in C# for the [CreateSymbolicLink][1] API function. The prototype in WinBase.h is: BOOLEAN APIENTRY CreateSymbolicLink ( __in LPCWSTR lpSymlinkFileName, __in LPCWSTR lpTargetFileName, __in DWORD dwFlags ); And BOOLEAN is defined as a BYTE in WinNT.h. Fine. So my managed proto...

Translate this VB.Net LinQ statement to C#, having trouble.

If Not IsPostBack Then Dim q=From f In System.Drawing.FontFamily.Families _ Select f.Name ListBox1.DataSource = q ListBox1.DataBind() End If I'm new to LinQ and I'm following a VB.Net tutorial so I don't know Linq in C#. Can anyone translate this to C# for me? ...

Pipes and Filters and CompiledQuery.Compile

Hi guys I have started using linq to sql and the entity framework and have found the development experience to be fairly good. Like the way you can break a query apart and combine different queries is quite nice - see pipes and filters. But the problem that I have found is that performance can be greatly increased (in my case by a fa...

Reading same file from multiple threads in C#

Hi. I was googling for some advise about this and I found some links. The most obvious was this one but in the end what im wondering is how well my code is implemented. I have basically two classes. One is the Converter and the other is ConverterThread I create an instance of this Converter class that has a property ThreadNumber that ...

Convert Latin 1 encoded UTF8 to Unicode

I came upon trying to convert a database that is encoded in UTF8 from what it looks like, into a windows 1251 encoding (dont ask, but I need to do this). All of the Russian, encoded characters in the db show up as абвгдÐ. When I pull them out of the db into my C# app, into strings, I still see абвгдÐ. No matter what I try to do...

WCF Security: incorrect credentials getting passed to service

Hi there, I have a problem where I am connecting to a WCF service from ISS and it's passing in the IIS application pool credentials instead of my windows credential. When i run the website locally by hitting F5 in VS it passes in my windows credentials which is what i want. My website is setup to use Windows Authentication and anonymou...

System.ObjectDisposedException from simple form display

I'm trying to figure out how when simply showing a WinForms dialog (code below) I get the following Exception and callstack. This doesn't happen all the time, but I'm seeing it in my exception logs. Any ideas? I can't figure out what would be referencing a disposed object? I've verified (via the rest of the callstack) that the applicat...

NetDataContractSerializer and WCF

Hi guys I have a scenario where I need to use the NetDataContractSerializer instead of the DataContractSerializer. Up until now I have been using this method - http://www.pluralsight.com/community/blogs/aaron/archive/2006/04/21/22284.aspx - which appears quite simple but according to this http://social.msdn.microsoft.com/forums/en-US...

reading USB Flash disk issue

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 + ASP.Net. I am using Silverlight 3.0 as well. I want to read the content of USB Flash disk at client side, the using the information in the USB Flash disk as user profile identifier -- just like online bank service is using USB key to store client certificate (but my securi...

Winforms - order of Load and Activated events

One of our users has sent in a log for our .NET Winforms application that indicates that the Activated event is occurring before the Load event. I didn't think this was possible and have coded with the assumption that Load would always happen before Activated. Has anyone else observed Activated occurring before Load? If so, why and ...

Differences between .NET network tracing levels

I'm trying to understand what the different output is for the various .NET Network tracing levels documented here: http://msdn.microsoft.com/en-us/library/ty48b824.aspx It states only what the possible values are, and not what the differences are. Required String attribute. Sets the verbosity of the output. Legitimate values a...

WCF Service which creates a new thread for every new request

Is there a way to configure a WCF Service to create a new Thread to handle any new incoming request? ...

Entity Framework Model Multiple Table to Single Entity

I've two tables named Modules and Privileges which are related by a foreign key relationship as shown below: I'd like to model Module and Privilege by adding ModuleName to Privilege. Later I'd be interested in creating a derived class (Menu in the illustration) from Privilege by adding a discriminating condition on ModuleName. Is this...

C# creating attribute that indicate running code after property call

Hello, I would like to create an Attribute to put on properties. The properties that will contains this attribute will execute another method after setting a new value. For example: [MethodExecute(Log)] [MethodExecute(Save)] public string Name { get { return name; } set ...