.net

programming from a usb stick, .net

I was wondering if there was a way I could program and compile .net applications (c#, asp.net mvc) from a usb stick on any laptop I plugged in. I am lookinjg for a solution that does not have me installing programs on the laptop, so I have to be able to run an ide or editor from an exe and compile presumably from command line. Was als...

Convert MS word file to Image in .Net C#

I want to convert Microsoft word into image file using .Net C#. also suggest any open source. Thanks for your help ...

Using Mapped Memory Files in C# to store reference types

I need to store a dictionary to a file as fast as possible. Both key and value are objects and not guaranteed to be marked as Serializable. Also I prefer a method faster than serializing thousands of objects. So I looked into Mapped Memory Files support in .NET 4. However, it seems MemoryMappedViewAccessor only allows storage of structs ...

tempDirectory compilation configuration

I'd like to add <compilation tempDirectory="MyPath"/> to the web.config of my webservice. Is it possible to specify a relative path? or it can only take an absolute path? ...

DatagridView Background does not refresh. Traces left behind.

I have a DataGridView bound on a generic list, in .NET 3.5. When this grid is resized, there is a residual traces that is left behind on the background of the grid where there is no items. This only occurs where there is some columns that have the WrapMode attribute set to True. It seems that only the content that is wrapped is not refr...

Is there a way to specify the culture when using System.Net.WebClient to read the contents of a page?

Is there a way to render a page with a specific culture using System.Net.WebClient? For example: System.Net.WebClient client = new System.Net.WebClient(); CultureInfo myCulture = System.Globalization.CultureInfo.GetCultureInfo("es-ES"); // Do something to specify the culture info client.DownloadString(someUrl); ...

Reading from registry as user on Vista / win 7

I'm storing a value in the registry with the first install date of my program. When I try to read this value as a USER (non-admmin) on Vista or Win 7, i get an error saying I don't have enough rights to read the registry ?? How can I read registry as a user, or how should I save my install date? ...

Creating many new instances vs reusing them?

I have multiple business entities in VB.NET Windows Forms application. Right now they are instanced on application startup and used when needed. They hold descriptions of business entities and methods for storing and retrieving data. To cut the long story short, they are somewhat heavy objects to construct (they have some internal dictio...

How should my team decide between 3-tier and 2-tier architectures?

My team is discussing the future direction we take our projects. Half the team believes in a pure 3-tier architecture while the other half favors a 2-tier architecture. Project Assumptions: Enterprise business applications Business logic needed between user and database Data validation necessary Service-oriented (prefer RESTful ...

How to determine Threading Model of given COM library?

I have a COM library I should use in my ASP.NET MVC application. However I am unsure about its thread apartment model. How can I determine it? ...

How do I transfer configuration data into injected objects?

I used to use Spring.Net and want to switch to Ninject 1.5 (I have to use .NET2, since some unlucky guy like me still needs to consider users working with win 2k). I used to have everything done in xml and only invoke the container during startup. In this way, only very limited codes are depending on container. I have scenarios like this...

[DllImport( "msvcrt.dll" )] in .Net 4: PInvokeStackImbalance Exception

I was using the strlen function from msvcrt.dll in a .Net 3.5 project. More specifically: private unsafe static extern int strlen( byte *pByte ); After migrating to .NET 4.0, if I use this function it throws a PInvokeStackImbalance exception. How can I import the .NET 3.5 msvcrt.dll or fix this exception? ...

Invoke a COM addin option from VBA

Can I invoke an option on a COM Add-in from a VBA macro in Word or Excel 2007? The COM Add-in was written using VSTO – it adds a custom ribbon tab with a number of options that I want to execute from a VBA macro. I can reference the add-in using Application.COMAddIns("MyAddinName") but I can’t find an option to invoke an option. I’ve a...

How to redirect by throwing an exceptions from an Asp.NET controller?

My controllers all extend a basic UserAwareController class, that exposes GetCurrentUser() method. I would like any call to this method to redirect to the login page if the user is not already logged in. Can I accomplish this by throwing some exception from this method? How can I cause a redirect to happen when this exception is thrown?...

What is a great resource for learning about the implementation details of .NET generic collections?

Hi all, I'm interested in understanding the underlying implementation details of generic collections in .NET. What I have in mind are details such as how the collections are stored, how each member of a collection is accessed by the CLR, etc. For collections that are analogous to traditional data structures, such as LinkedList a...

Replace all & that are not a HTML entity using C#

Basically a dup of this question using php, but I need it for C#. I need to be able to replace any & that is not currently not any HTML entity (e.g. &amp;) before outputting to screen. I was thinking a regex, but I'm not sure if .Net has something built in that will do this. ...

What is Polymorphism?

Possible Duplicate: Try to describe polymorphism as easy as you can What is polymorphism? ...

Using TaskDialogIndirect in C#

I've been working for a while with the regular Windows Vista/7 TaskDialog for a while, and I wanted to add some additional functionality (like custom buttons and a footer), so I need to use TaskDialogIndirect. Following the MSDN documentation for TaskDialogIndirect, I got this signature: [DllImport("comctl32.dll",CharSet = CharSet.Unic...

Is there a way to get an ASMX Web Service created in VS 2005 to receive and return JSON?

I'm using .NET 2.0 and Visual Studio 2005 to try to create a web service that can be consumed both as SOAP/XML and JSON. I read Dave Ward's Answer to the question How to return JSON from a 2.0 asmx web service (in addition to reading other articles at Encosia.com), but I can't figure out how I need to set up the code of my asmx file in ...

Simple Oracle File repository with folder hierarchy

I have an application that stores large amount of files (XML and binary) in folder hierarchies. Currently the main method is storing them in file system or using a legacy CMS, which we want to get rid of. The CMS supports Oracle and a customer wants to keep the files in Oracle because of enterprise policies (backup etc.) The question i...