.net

[Pattern]Keep transaction in a queue

Hi everybody, For the moment, when an exception occur, I show a message error to the user. But I want, in this case, keep the transaction in a queue to retry again later. Do you know if a pattern to resolve my problem exist ??? thanks, Tkanos ...

[.Net/Reflection] Getting the .Net corresponding type of a C# type

Hello, is there a function that, given a C# type's string representation, returns the corresponding .Net type or .Net type's string representation; or any way to achieve this. For example : "bool" -> System.Boolean or "System.Boolean" "int" -> System.Int32 or "System.Int32" ... Thanks. Edit : really sorry, it's not a "type to type...

Security problem w/ NHIbernate in Medium Trust in a Hosted Environment

My hosting provider (hostmysite.com) just changed to running medium trust on their hosted servers. This has caused the following NHibernate to product the following error: [SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b...

How can I change the CurrentCulture of the entire process (not just current thread) in .Net?

I have a situation where I need to set my process' locale to en-US. I know how to do this for the current thread: System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); But my application uses BackgroundWorkers to do some processing, and the locale for these worke...

.NET Projects: Where do I put .resx files?

Hello! Where do I put .resx files? Sometimes I see these files under Properties folder. Is there any design guideline about it? Thank you! ...

Using configSource, and changing restartOnExternalChanges for core section

I'd like to use the configSource attribute of my web config section to define external files for various settings. Particularly, the appSettings section. This means my config file has the following entry: <appSettings configSource="My.AppSettings.config" /> However, if this file is updated, the settings are not automatically picked u...

Action with set of fixed parameters in url and a set of optional parameters either from post or from querystring

In my route collection I have routes.MapRoute( "Recalculate", "{siteLanguage}/Formula.mvc/relcalculate/{identifierString}/{formulaId}/{wratio}/{customRecalcString}", new { controller = "Formula", action = "Recalculate", wratio = "", customRecalcString = "" } ); The action it maps to is public ActionResult Recalculate(string ide...

How to use Assembly Binding Redirection to ignore revision and build numbers

I have several .NET applications in C#, along with an API for them to access the database. I want to put all versions of the API in the database, and have them pick the highest revision and build number, but stick with the major and minor number they were built with. Basically when I reference API 1.2.3.4 I want the reference to read 1.2...

How to check if a file exits on an webserver by its URL?

Hi, in our application we have some kind of online help. It works really simple: If the user clicks on the help button a URL is build depending on the current language and help context (e.g. "http://example.com/help/" + [LANG_ID] + "[HELP_CONTEXT]) and called within the browser. So my question is: How can i check if a file exists on th...

ASP.NET MVC & ASP.NET AJAX Toolkit AutoCompleteExtender

Can I make an ASP.NET AJAX AutoCompleteExtender use an ASP.NET MVC JsonResult rather than an ASMX Webservice? I've got an ASP.NET AJAX Toolkit AutoCompleteExtender on an ASP.NET MVC View. It uses an JsonResult type function in my MVC Controller. ASP.NET MVC View: <form runat="server"> <asp:ScriptManager ID="ScriptManager1...

Url registration issue with WCF when Http binding is used

I'm trying to host two WCF services in one application. I want them to share the same BaseAddress but have their own URLs something like: net.tcp://localhost:1234/service1 and net.tcp://localhost:1234/service2 The following config allows me to do that: <system.serviceModel> <services> <service name="VanillaWcf.Shared.MyServ...

Getting Font information in .net

Hi, I was wondering if anyone knows how to programatically get things like the version and copyright details out of a true type font. If you open it in explorer as well as the preview you get this info in the windows font viewer. I've looked at the Logfont structure but the info doesn't seem to be in here Cheers Luke ...

How to get file name of .EXE

Possible Duplicates: Getting the path of the current assembly C#: How do I get the path of the assembly the code is in? Using VB 2008, how can I get the file name of a running .EXE from inside itself? EDIT: This is for a console app, so Application.ExecutablePath will not work. ...

Methods to programmatically install a .NET assembly into the GAC

I need to create a small app or script to install a .NET assembly into the GAC. I've read there are a couple ways to do this including: using gacutil.exe executing the following line of code: new System.EnterpriseServices.Internal.Publish().GACInstall("Foo.dll"); However, what would happen if I just created the appropriate director...

IIS7 Staticfilehandler changing GIF file colors

Environment: 2 IIS7 servers, 1 appears to be compressing images the other is not, i want to turn off the compression. I have a site running on two IIS7 server, when serving images from one server the GIFs look fine, when i serve them from the other instance, with the same files, the GIF color palette looks web safe or compressed or some...

How to access SAPI 4 voices from .net framework 3.5

I’m trying to use a SAPI 4 engine (L&H TTS 3000) from .net 3.5 using System.Speech.Synthesis in windows XP. The problem is than I can only get SAPI 5.1 engines when I call GetInstalledVoices. I’m using SAPI 4 because I need a Spanish TTS engine and L&H TTS 3000 is the only one free that I have found. ...

Singleton Pattern in .Net is not possible?

Hi Guys I have a very interesting situation , i have figured out that Singleton pattern is not all possible with .net framework (Any version) look at this code below namespace SingletonPattern { class Singleton { private static readonly Singleton instance = new Singleton(); private static int mcount = 0; private ...

How do you manage generated code in Visual Studio - in particular, creating DLLs from .idls.

I'm trying to add a generated COM interop assembly project to my solution, and the only solution I could come up with feels really nasty. I created a .net dll project, removed all .cs files from it and then created the following post-build event: call "$(DevEnvDir)..\tools\vsvars32.bat" midl.exe $(ProjectDir)relative-path-to-my-idl\MyC...

DataTable.Merge and DataTable.ImportRow does not change RowState

I am having issues with ADO.NET 2.0 merging/importing data. I need to update/insert data from one generic table to another table with both tables maintaining an identical schema. The following code works great locally, but does not make changes to the database: OleDbDataAdapter localDA = loadLocalData(); Ol...

.net ServiceController - Unable to open service "service name" in machine '.'.

I'm trying to access a windows service (also created by me) through a WinForms application using ServiceController: service = new System.ServiceProcess.ServiceController("MyService") The service returns OK and I can see the status via myservice.Status. But when i try to start (or stop) it, it returns the error: Unable to open ser...