.net

c#:How to add a attributes to an object at runtime?

As an entity class, I want to add a attributes at runtime, how should I do?Thanks! ...

ASP.net page without a code behind

I have an ASP.Net page with a C# code behind. However, I've been asked to not use a code behind - so that it will be easier to deploy in SharePoint. Is there a way to include the C# code in the ASP.Net page, without using a separate code behind file? ...

Cancelling a Socket.xxxxAsync call

After calling Socket.Shutdown, Socket.Close and Socket.Disconnect, it appears that Socket.ReceiveAsync does not abort. Attempts to reuse the SocketAsycEventArgs object used in the ReceiveAsync call (suggested in the documentation as best practice) result in the error: An asynchronous socket operation is already in progress using this...

Work out the type of c# application a class contained in a DLL is being used by

Is there any way to know in C# the type of application that is running. Windows Service ASP.NET Windows Form Console I would like to react to the application type but cannot find a way to determine it. ...

Encrypting config files for deployment

Hi, I have a windows service that reads from app.config. I want some settings to be encrypted, however, I don't want to use the ProtectedConfigurationProvider classes provided in .NET because they encrypt files based on the machine they are running on using DPAPI. What I wanted was a way for our administrator to deploy the config file...

Why does Thread.Sleep(0) fix my problems, and how to avoid it?

I'm working on a client server application. At certain times, on certain machines, when there's more than 5 clients requesting data, it seems to reach a deadlock. If I step in to debug the problem, then the program appears to be processing. Simply setting a break point where I know the program is executing, and causing it to hit the b...

Secure, portable encrypted config values -- possible?

I'm just curious if anyone has any great ideas on this. We have a lot of C# windows services. Each app is installed on multiple machines (anywhere from 2-80, depending on the app.) Due to the security setup of the network, we cannot (consistently) use Windows authentication to the SQL servers, so our connection strings and credentia...

Dotnet upgrade - 2.0 to 3.5 - performance

we have a number of winforms apps that are written in dotnet 2.0. are there any performance upgrades that we would expect when moving to 3.5 runtime. Any particular benefits besides the language features ...

Fluent NHibernate: How to map a db integer to a datetime column?

I have a class public class Site { public DateTime SiteMonth {get; set;} } in the database the SiteMonth is represented as an integer in yyyymm format. Is there a way to map this in NHibernate without introducing a new property on my Site class? ...

Correct name for non-COM, non-.NET DLL?

In the Windows world, what is the correct name for a good. old-fashioned C++ DLL with exported functions? Not a COM DLL, not a .NET DLL. The kind of DLL that we used to invoke by calling LoadLibrary() and GetProcAddress()? I've always called them "flat DLLs" because the caller cannot instantiate objects from the DLL, but what is the co...

.net Runtime - Silverlight Runtime = ?

I've googled around a bit, and I haven't been able to find a good listing of what classes from the .net CLR are not included in the 'CoreCLR' aka Silverlight. What is Silverlight missing from the Windows .net Framework? Also, is there anything that the Silverlight runtime has that the .net Framework doesn't? ...

Special folder information in OS

Does using Environment.SpecialFolder gurantee the right folder information on all windows OS's? ...

How to abort the call to webservice at both client and server end?

I can abort the web service call from client by calling ABORT method of web service proxy. However at server where web service is hosted, the call only ends when it completes the processing. As server doesn’t expect any other inputs related to already called web method while processing it, I am not able to close it from client. Is the...

Reset checkboxes in datalist on click of button that is outside of datalist using c#

Reset checkboxes in datalist on click of button that is outside of datalist using c# ...

Time bomb needed in ASP.NET application

We've developed a bespoke ASP.NET application for use on our customer's intranet. It appears they're unlikely to pay for it, so our boss would like us to introduce a time bomb. [Edit:] Technical responses only please! Whether this is a good (or legal) idea is a question for CEOoverflow.com ;-) All pages in the application inherit from...

If you had to pick a free CMS to integrate with ASP.NET MVC what would you pick?

I am looking for starting from scratch with a CMS - specifically one that will integrate well with ASP.NET MVC. preferably somebody has written Html Helpers for me must be easily editable by an idiot must give me really nice clean HTML must be able to store simple strings, or full blown documents would really prefer SQL server as the ...

DLast equivalent in .Net

In Microsoft Access, there is this DLast function that returns the application key of the last value from a specified set of records. I wonder what is the equivalent of DLast in .Net that enables me to retrieve the primary key of my last insert? I am using Access over OLEDBConnection ...

How can I make a ElementHost transparent so that the form behind it is visible and clickable?

I tried to derive a class form ElementHost and overiding the CreateParams method: protected override CreateParams CreateParams { get { const int WS_EX_TRANSPARENT = 0x20; CreateParams cp = base.CreateParams; cp.ExStyle = cp.ExStyle | WS_EX_TRANSPARENT; return cp; ...

How can I get rid of the "The target assembly contains no service types" error message in VS2008 ?

I've got a Client/Server wcf application My executable doesn't define any ServiceContract, it doesn't even have a reference to System.ServiceModel (but instead has a reference to an assembly which contains the connection logic to the server) I've another assembly, which is referenced by my exe, which contains a ServiceContract. It use...

Is it safe to dispose the Icon after calling Icon.ToBitmap()?

After calling System.Drawing.Icon.ToBitmap() to create an image, is it safe to dispose the original Icon? ...