.net

How to detect if a Type is a generated DynamicProxy without referencing Castle DynamicProxy?

I am using castle DynamicProxy and was wondering if there is a way of detecting if a Type is a proxy without referencing Castle DynamicProxy? So while I am using Castle DynamicProxy as an example I would like code that would work for any in memory generated type. var generator = new ProxyGenerator(); var classProxy = generator.Create...

how to store/retreieve RSA public/private key

I want to use RSA public key encryption, and I'm wondering what is the best way to store or retrieve private and public key. Is XML a good idea here? How to get the keys? RSAParameters privateKey = RSA.ExportParameters(true); RSAParameters publicKey = RSA.ExportParameters(false); Because RSAParameters have the following members: D, D...

How to find overlapped items?

Dear all, Is it possible to find out whether one drawing line (which is not in a horizontal or vertical position) overlapped (or touched) any other items (like line, rectangle, circle etc). Kindly advise me on the possibilities and solution with examples. Thanks for looking into this... ...

add two double given wrong result

I'm using the following piece of code and under some mysterious circumstances the result of the addition is not as it's supposed to be: double _west = 9.482935905456543; double _off = 0.00000093248155508263153; double _lon = _west + _off; // check for the expected result Debug.Assert(_lon == 9.4829368379380981); // sometimes i get 9.48...

Autorun a CD from Process.Start

What is the closest way to emulate autorunning a CD (or other media, I guess) using Process.Start and ProcessStartInfo? I've tried obvious things like: // Just opens the folder Process.Start("F:"); // Ditto Process.Start(new ProcessStartInfo("F:") {UseShellExecute = true}); // Throws System.ComponentModel.Win32Exception: No applicati...

method hiding in c# with a valid example .why is it implemented in the framework.? what is the Real world advantage.?

Can anyone explain the actual use of method hiding in C# with a valid example ? If the method is defined using the new keyword in the derived class, then it cannot be overridden. Then it is the same as creating a fresh method (other than the one mentioned in the base class) with a different name. Is there any specific reason to use th...

PHP developer to .net development

Hi, I know it is not a programming related, I am in PHP Development for last 2 years, now will it be possible(how hard) or advisale for me to shift to .net Development. any help ? Thanks in Advance, ...

How do you debug ASP.net HTTPHandler

I have set a breakpoint in an HTTPHandler in visual studio. The HTTPHandler is an .ashx file I am trying to debug by running my application in the VS development web server. My breakpoint is NOT getting hit. How can I step through it? EDIT: My breakpoint is NOT getting hit ...

Altering tables with Windows Azure

I'm using the following method to create tables in Windows Azure. This code is executed only once when the application is first initialized TableStorage.CreateTablesFromModel(typeof(customDataServiceContext), account); If I have updates (ex. new columns) that I want to make to the table, how do I go about making those updates without...

Where to dispose IDisposable members of an ASP.net page?

What is the best practice to dispose IDisposable members of an ASP.net page? Should I, ... use the Page_Unload(object sender, EventArgs e) event override the void Dispose() method of the Control class something else ... ?? ...

Why are many ports of languages to .net prefixed with 'Iron'?

Was discussing over lunch why several ports of languages to the .net framework are prefixed with 'Iron'. e.g. IronPython IronRuby IronLisp IronScheme IronPHP Anyone out there know? (language list sourced from http://www.dotnetpowered.com/languages.aspx) ...

How can you programmatically change the workgroup of a machine?

Is there any way to programmatically change the workgroup a machine (XP, Vista, and Win 7) belongs to (ideally from a .NET language)? I've found code to help determine which workgroup a machine belongs to, but in some cases I may need to change this. This sounds a bit weird, but I'm thinking about building an automatic recovery installa...

What names do you find yourself prepending/appending to classes regularly?

Which nouns do you find yourself putting regularly at the end of your classes? For example, I have a habit of sticking Info onto classes that pass information around but don't do a great deal: ImportInfo SiteInfo Or for Coordinating classes: UserManager SecurityManager I end up using Builder quite often for string related classe...

Connect remote SQLServer Database programmatically using VPN

Hey Ya'll, I can connect to VPN and I can access Sql Server using RDP. Now, I want to access the Sql Server programmatically. I connected to the VPN and then have the following connection string set up: **constr = 'Data Source=servername;Initial Catalog=dbname;User ID=username;Password=passwd;' error: login failed for username PS: ...

What's a common way to test an API that makes requests that return very dynamic JSON

We've written a .NET wrapper API for a set of web services. All this does is make requests and return JSON data. What's a good way to build a test framework for this? I can't think of how to do unit tests since I'd have to know the expected JSON string I'm getting back and that's very dynamic and complex. I thought of doing a WebTest but...

How do I copy a .eml file when I have the uri?

I am using webDAV and .Net 2.0 to gather information on an email account on a server running Exchange Server 2003. I have access to the uri which looks like this: http://my.mailserver.com/exchange/user/Inbox/someImportantEmail.EML I attempted to copy the file like so: Dim uri As New Uri(uriNode.InnerText) If uri.IsFile() Then ...

object creation in stack

Can I create an object of my class in stack regarding .net and C#? For example: class abc { int i=1; } abc a1=new abc(); Now, here the object is created in heap. So, is there any way to create the object in stack memory of ram if the size of object is not big? ...

ampersand url encoding issues

I'm hard coding a url to have something like this: "/ContactUs.aspx?mode=New&form=Contact" the page is rendering the below as part of the url... mode=New&amp%3bform=Contact so the page breaks when i rediriect to this page. and try to Request.QueryString["form"]. how can i make it behave with the & symbol ...

Dynamic commands without code compiles and re-deployment

Situation: Currently we have type safe static code that represents commands we can send to units out in the field. In addition we have another development team who does development on the units, they implement commands on a different release cycle then us and management is asking for our side to be more flexible as in create code that wi...

Does SQL Server Compact Edition depend on the .net framework?

My company is looking at using SQL Server Compact Edition 3.5 as a datastore for a few programs that have been developed over the last several years. Most of these programs are were written in C++ and are installed on some older machines with Windows 2000, XP, or Vista installed. Does SQL Server Compact Edition 3.5 depend on the .net fra...