.net

How to prevent crash when a referenced assembly isn't found?

I have a small command line program that uses the Team System API. When the correct Team System isn't installed on the machine, the program prints a traceback with System.IO.FileNotFoundException, but it also crashes and shows the standard error messasge: XXX has encountered a problem and needs to close. We are sorry for the inc...

How to get a web development gig when my ASP.NET experience is a year and a half old?

How to get a web development gig when for the past year and a half have been working on C# libraries and user control. I have lost a bit of touch with ASP.Net 2.0 and have been familair with the older version of ASP.NET. Employers see this lack of web development in the past year as a big red 'NO' sign. I have been writing assemblies fo...

C# : Characters do not display well when in Console, why?

The picture below explains all: The variable textInput comes from File.ReadAllText(path); and characters like : ' é è ... do not display. When I run my UnitTest, all is fine! I see them... Why? ...

String vs string in C#

In C# the string keyword (highlighted in Visual Studio as a data type) is just a shortcut to the String class right? In that case, it would be the same to use either while coding from the semantic point of view. However, is it the same from the performance point of view? I mean, when the mapping is performed: during compilation (I guess...

Regex for strings ending in .cs but not in .g.cs

I need a regex that matches all strings ending in .cs, but if they end in .g.cs they should not match. I'm using .NET regular expressions. ...

Display WPF modal window/dialog/panel the same way as a NSWindow can be displayed like a sheet in Cocoa

I am looking for a way to display a modal window in WPF the same way as a window in Cocoa can be displayed as a sheet, i.e. it slides down from the titlebar in front of the main parent window. My guess is that this would be accomplished by having the modal window as a user control which is loaded into a panel when displayed, and that th...

How to load MS Word document in C# (.NET)?

Hi, How do I load MS Word document (.doc and .docx) to memory (variable) without doing this?: wordApp.Documents.Open I don't want to open MS Word, I just want that text inside. You gave me answer for DOCX, but what about DOC? I want free and high performance solution - not to open 12.000 instances of Word to process all of them. :(...

SQL for the web

Does anyone have experience with a query language for the web? I am looking for project, commercial or not, that does a good job at making a webpage queryable and that even follows links on it to aggregate information from a bunch of pages. I would prefere a sql or linq like syntax. I could of course download a webpage and start doing ...

How do I send bulk mail to my users in a generic fashion?

I have a continually updating SQL database with email addresses from my users. I would like a way to send them newsletters, general information, account information, billing, subscriptions, and other important information. I want to make a generic HTML/Text template for each bulk mail and have SQL fill out the rest of the information. ...

Anyone have a C# example showing an owner drawn tabcontrol with hot-tracking effects?

Anyone have a C# example showing an owner drawn tabcontrol with hot-tracking effects? I've implemented a nice owner drawn tabcontrol using C# and .NET 2.0 but i'm stumped when it comes to implementing hot-tracking effects. Any Ideas? ...

Is there any reason to use System.Uri?

I'm looking it over and it seems to be that it is fundamentally broken. Only 5 instance methods aren't marked obsolete. There doesn't appear to be any built-in way to parse query-string variables. There are no methods to mutate the Uri, for example appending a new query variable. HttpUtility works on strings, not URIs So is there an...

Prevent DTD download when parsing XML

When using XmlDocument.Load , I am finding that if the document refers to a DTD, a connection is made to the provided URI. Is there any way to prevent this from happening? ...

How do I make virtual URLs point to .aspx pages in asp.net deployed on an IIS? (preferably without IIS)

What's the best way to get a nice clean URL structure like stack overflow has? Do I need to use IIS for this? Or is there a way I can do it with some sort of mapping file in asp .net? The site I want this for has hundreds of pages, and is already deployed. I would like a method that requires the least amount of changes possible. Not...

Options for in-process databases under medium trust

I have seen a few different in-process SQL databases for .NET (including one from Microsoft), but either they do not work under medium trust (ASP.NET) or the documentation/websites don't even talk about. What experiences have you had with in-process databases in general, and do you know of any that work under medium trust for ASP.NET? ...

How to compress files in .NET 1.1

I need to compress files in [*.zip] format in .NET 1.1. I don't want to use SharpZip for compression as I got random errors - "Access Denied" - when running it in .NET 1.1. SharptZip will work properly only if I put the assembly on the GAC - which is not an option in my project. This is the problem. Check this: http://forums.asp.net/p/...

Charts in webpages

What I'd like to accomplish is to present charts on webpages. For example aspx pages gridviews that present a two column table are able to be copied & placed into Excel then a chart created. The pages I currently use most are ASP.NET 3.0 or SharePoint team sites with stored procedures. People are very interested in how people perform cha...

Help with using TypeConverters for enums in an Excel PIA assembly

I would like to use a TypeCoverter to regionalise output for enums in an assembly that is a PIA loaded into Excel. I can run this and it works on an assembly in a test project I created with an explicitly referenceed assembly, however when running a project that has been built as an Excel PIA. If I try: _ public enum MyEnum ItemA ...

NHibernate custom SQL object creation

Somewhat-simplified example situation: I have entities A and B which are incredibly "heavy" domain objects. Loading one from the database is a pretty big deal. Then I have an entity C, which is a very simple object that has a label string, one A, and one B -- both lazy. I'm doing some low-level querying to create huge lists of C, so I k...

How do I format to only include decimal if there are any.

What is the best way to format a decimal if I only want decimal displayed if it is not an integer. Eg: decimal amount = 1000M decimal vat = 12.50M When formatted I want: Amount: 1000 (not 1000.0000) Vat: 12.5 (not 12.50) ...

Why exactly isn't MEF a DI/IoC Container?

It's been said on the blogosphere and by MS themselves that MEF isn't another IoC Container. Ok...but why? It seems the same to me. Maybe it's not as good as Unity or castle Windsor, but it still fits the definition, doesn't it? Can anyone explain why MEF isn't an IoC Container like Unity or Castle Windsor? ...