.net-2.0

SerialPort.GetPortNames() returns incorrect port names

限于喜欢 提交于 2019-12-04 11:11:48
问题 While c# is not my primary programming language, I'm maintaining such a program for a couple of years now. This program connects to a device on a serial port and works from Windows XP up to 8.1. One specific "feature" is that it uses .NET Framework 2.0. With some users upgrading to Windows 10 we've got complains that the program cannot detect/open the COM port of the device. We have confirmed this on our own test systems with clean Win10 installation. It turns out that the function SerialPort

Password Recovery without sending password via email

☆樱花仙子☆ 提交于 2019-12-04 10:21:15
So, I've been playing with asp:PasswordRecovery and discovered I really don't like it, for several reasons: 1) Alice's password can be reset even without having access to Alice's email. A security question for password resets mitigates this, but does not really satisfy me. 2) Alice's new password is sent back to her in cleartext. I would rather send her a special link to my page (e.g. a page like example.com/recovery.aspx?P=lfaj0831uefjc), which would let her change her password. I imagine I could do this myself by creating some sort of table of expiring password recovery pages and sending

Logging for ASP.NET - Best Practices [closed]

泪湿孤枕 提交于 2019-12-04 10:16:52
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . What is the best way to write minimal error logs in an ASP.NET 2.0 web page or web service? For my purposes it'd be best if this was

Does Application.ApplicationExit event work to be notified of exit in non-Winforms apps?

烂漫一生 提交于 2019-12-04 09:41:13
问题 Our code library needs to be notified when the application is exiting. So we have subscribed to the System.Window.Forms.Application.ApplicationExit event. This works nicely for Winforms apps, but does it also work for other types of applications such as console apps, services, and web apps (such as ASP.NET)? The namespace would suggest that it doesn't, and it presumably gets raised when Application.Exit() is called (explicitly or implictly), which may not be correct to call for these other

The client (desktop app) pulls data…but I want the server (web app) to push data

我只是一个虾纸丫 提交于 2019-12-04 09:37:12
问题 I have a client-server application - wherein the server is essentially an ASP .NET web application and the distributed clients are desktop applications. The clients need to receive some data from the server - when there is new data for the client. Right now, the way this is done is - the client keeps querying a web service every x minutes (say 2 minutes) and keeps checking if there's new data for the client. Ideally, the way it should work is that the desktop app should receive updates as and

Unable to add Rhino Mocks 3.5 to a .NET 2.0 project in Visual Studio 2010

跟風遠走 提交于 2019-12-04 09:07:20
We're upgrading from Dev Studio 2005 to Dev Studio 2010. I opened my 2005 solution in Visual Studio 2010 and went through the conversion process keeping all projects targeted at .NET 2.0. When I try to build the project, my references to Rhino.Mocks.dll are failing to be used. I see errors like this: DalDiscoveryTest.cs(7,7): error CS0246: The type or namespace name 'Rhino' could not be found (are you missing a using directive or an assembly reference?) I went into my project and removed the reference to Rhino.Mocks.dll and attempted to re-add it. Then I get a dialog that reads: 'Rhino.Mocks

How can I make DataTable enumerable?

心不动则不痛 提交于 2019-12-04 09:03:30
I cannot use AsEnumerable() on DataTable, I'm using C# 3 but I'm just targeting 2.0 framework (LINQ capability is courtesy of LINQBridge ). Is there any way I can make DataTable enumerable without using Select() ? bool isExisting = (bdsAttachments.DataSource as DataTable).Select().Any(xxx => (string)dr["filename"] == filename); Update: I wanted it to make it look like this: bool isExisting = (bdsAttachments.DataSource as DataTable).AsEnumerable().Any(xxx => (string)dr["filename"] == filename); I'm getting an inkling that the Select method of DataTable returns a copy, I'm thinking to just use

What's the easiest way to verify there's an available network connection?

怎甘沉沦 提交于 2019-12-04 08:36:31
问题 I'm a bit of newbie to c#/.net development, but I've put together a stock tracking application for a small set of assets in my company. I have also set up the database it connects to in SQL 2000. It currently works brilliantly when a network connection is available, but I want to expand it for use when I'm away from a connection. First off I'll need to know if there's a connection available. So I put this together: private int availableNetAdapters() { int nicCount = 0; foreach

Can .NET 4.0 code interoperate with .NET 2.0 code?

China☆狼群 提交于 2019-12-04 07:57:15
问题 Are there compatibility barriers with a .NET 4.0 assembly calling code in a .NET 2.0 assembly? And vice versa? More specifically, I'm investigating an upgrade to Visual Studio 2010 when using a third party application based on .NET 2.0. The application is extensible by hooks that reference my custom code. And vice versa, my code will reference the application's assemblies. 回答1: The CLR, in .NET 4, can consume .NET 2 assemblies and use them properly. If you want your .NET 2 application to be

C# How do you get the operating system architecture (x86 or x64)? [duplicate]

社会主义新天地 提交于 2019-12-04 07:44:27
Possible Duplicate: How to detect Windows 64 bit platform with .net? How can I retrieve the operating system architecture (x86 or x64) with .NET 2.0? I have not found any good method to get the OS architecture on Google. What I found was how to tell whether the process is 32-bit or 64-bit. If there isn't anyway to find out in .NET 2.0 please tell me. :) Not the accepted answer in the duplicate question, but this is how I'd do it: Use GetEnvironmentVariable to look for the PROCESSOR_ARCHITEW6432 variable. If it doesn't exist, you must be running 32bit: bool is64bit = !string.IsNullOrEmpty(