.net

What should I use for password fields in a table; MD5 or SHA1?

I am by no means a security expert or even a novice. I'm a newbie at security at best. Someone suggested I use SHA1 instead of MD5 - why would I choose one over the other? Is one more secure? ...

WCF: Comparisons between not closing ChannelFactory vs. constantly recreating the ChannelFactory and closing it

I have a WCF service that I consume in my code and generated as a ChannelFactory class. I know that the proper way to consume the WCF is to create the ChannelFactory (let's call this AwesomeClient), do the work, then call Close() on it. Here's my snippet: public static void DoSomething() { var client = new AwesomeClient(...

C# & C++, runtime error when call C++ dll from C#

I have written a C++ wrapper DLL for C# to call. The DLL was tested and worked fine with my C++ test program. now integrated with C#, I got runtime error and crashed. Cannot use debugger to see more details. The C++ side has only one method: #ifdef DLLWRAPPERWIN32_EXPORTS #define DLLWRAPPERWIN32_API __declspec(dllexport) #else #define...

.NET Interop SendInfo - Can't get it to work..?

I'm using the following code to simulate a mouseclick. However I get the following error message: File I/O of a structure with field 'dwExtraInfo' of type 'IntPtr' is not valid What am I missing here? Dim inputEvents(0) As Input Dim p As MOUSEKEYBDHARDWAREINPUT p.mi.dx = x p.mi.dy = y p.mi.mouseData = 0 p...

Will a SHA256 hash always have 64 characters?

I'm setting up my database to receive hashed passwords and not accept plain text. Would I go something like this? create table User( username varchar(20) not null, password varchar(64) not null, ); ...

What is the compatibility on .NET 4.0?

We have several .NET applications developed in .NET 3.5 (Windows services, web applications, and WCF services) in different servers. I'd like to migrate to .NET 4.0 and use VS.NET 2010. Does VS.NET 2010 compiles to .NET 3.5 to avoid full simultaneous migration, being able to stop using VS.NET 2008 but maintaining some applications in ...

Changing SOAP Version in VS2008

Hi, In 2004/5 I built web services to be consumed by a clients partner site in VS2003 ASP.NET 1.1 VB. I have just completed rebuilding the services in VS2008 ASP.NET 3.5 VB. During functional testing from the partner site, it seems none of the services work correctly and some not at all. Yet when tested using SOAPUI or via VS2008 debug...

How can I save/print values in my WATCH list in Visual Studio 2008?

When I attach the Visual Studio 2008 debugger to my web server process, I sometimes browse a large amount of data in my watch list. Suppose I have an array of string variable that I expand to show 20 entries. It seems that the only way to save these values is to copy and paste them one at a time. I have gone so far as to do a screen-s...

Identifying if a user is in the local administrators group

My Problem I'm using PInvoked Windows API functions to verify if a user is part of the local administrators group. I'm utilizing GetCurrentProcess, OpenProcessToken, GetTokenInformationand LookupAccountSid to verify if the user is a local admin. GetTokenInformation returns a TOKEN_GROUPS struct with an array of SID_AND_ATTRIBUTES stru...

.NET ReportViewer- How can I put totals at bottom of each page

I have a created a report for payments and I need to be able to put totals at the bottom of each page such as the total number of payments, total balance etc. The rdlc designer will not allow me to reference Fields in the page footer? Thanks for the help ...

.NET Web Service (asmx) Timeout Problem

I'm connecting to a vendor-supplied web ASMX service and sending a set of data over the wire. My first attempt hit the 1 minute timeout that Visual Studio throws in by default in the app.config file when you add a service reference to a project. I increased it to 10 minutes, another timeout. 1 hour, another timeout: Error: System.Tim...

How to avoid exceptions catches copy-paste in .NET

Working with .NET framework I have a service with a set of methods that can generates several types of exceptions: MyException2, MyExc1, Exception... To provide proper work for all methods, each of them contains following sections: [WebMethod] void Method1(...) { try { ... required functionality } catch(MyExcept...

Run time behavior of .NET referenced assembly not existing.

Microsoft .NET Framework Assembly A Assembly B Contains Class C - References Assembly A Contains Class D - Does not reference Assembly A, Does not reference Class C Questions: During runtime if Assembly A DLL does not exist, will Class D be able to execute successfully? Where as Class C will fail with a reference error? ...

Why would a 'public event EventHandler cccc' be null?

Why would a 'public event EventHandler cccc' be null? I have a class that's public class Builder { public event EventHandler StartedWorking; public Builder() { // Constructor does some stuff } public void Start() { StartedWorking(this, eventargobject); //StartedWorking is null -- } } ...

C# Encryption exception

i Team, I have the following encryption code in C#. I am getting an exception as Specified initialization vector (IV) does not match the block size for this algorithm. Could you please tell me what is the missing link here? //Key and IV for RSA Encryption byte[] ketByte = Encoding.UTF8.GetBytes("C3CA193570B26E5C3CBB50FD805A01S2"); byt...

Determine if Alpha Channel is Used in an Image

As I'm bringing in images into my program, I want to determine if: they have an alpha-channel if that alpha-channel is used #1 is simple enough with using Image.IsAlphaPixelFormat. For #2 though, other than looping through every single pixel, is there a simple way I can determine if at least one of the pixels has an alpha channel tha...

How Can I Generate Random Unqiue Numbers in C#

public int GenPurchaseOrderNum() { Random random = new Random(); _uniqueNum = random.Next(13287, 21439); return UniqueNum; } I removed unique constraint from the PONumber column in the db because an employee should only generate P.O. # when the deal is set. Otherwise, P.O. # would have 0. P.O. Number used to have unique co...

How can i download openGl for C#?

How can i download openGl for C#? ...

Strategies for testing reactive, asynchronous code

I am developing a data-flow oriented domain-specific language. To simplify, let's just look at Operations. Operations have a number of named parameters and can be asked to compute their result using their current state. To decide when an Operation should produce a result, it gets a Decision that is sensitive to which parameter got a val...

Mapping custom POCO in Entity Framework 4

So I have a small issue with converting a string to a boolean when EF maps to my POCO. I created custom POCOs and I have one that has a boolean property called "IsActive". But, in the database the tables column "IsActive", that maps to the POCOs property, is a string. It's either 'Y' or 'N'. EF doesn't like this, so I'm wondering if th...