.net

Visual Studio 2005 link error

I am getting an linking error in Visual Studio 2005: mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) What could be the reason for this error? " /INCREMENTAL:NO /NOLOGO /LIBPATH:"..\RtpDll\libs\Release" /LIBPATH:" packet.lib winmm.lib ws2_32.lib and other some project-dependent libra...

Get source filename or per file identifier using Reflection?

I looked and it doesnt seem possible but it might be. Using reflection i would like to know if two classes were compiled/defined in the same source file? I would like to use a class as a configuration file and found a way to do it per namespace but would like to use a per file solution ...

How do I start using patterns and practices efficiently?

hi How do I start using patterns and practices efficiently for developing .net applications? ...

.Net IPAddress IPv4

Hi, I have the following code: Dim ipAdd As IPAddress = Dns.GetHostEntry(strHostname).AddressList(0) Dim strIP As String = ipAdd.ToString() When I convert to String instead of an IPv4 address like 192.168.1.0 or similar I get the IPv6 version: fd80::5dbe:5d89:e51b:d313 address. Is there a way I can return the IPv4 address from IPAdd...

Rendering HTML Content from AJAX result

I am writing an application that renders a list of "Job" objects from an AJAX JSON response. What is the best way to Render the markup from the returned data. Now I'm pretty convinced that its a bad idea to generate HTML markup on the server side and return that from the AJAX call. From experience it makes the HTML hard to maintain an...

how to get host name of all LAN systems using c#.net

how to get host name of all LAN systems using c#.net through "net view" command am getting some systems host names, not able to access all the systems even though they are in the LAN. why so? ...

.NET HttpWebRequest Speed versus Browser

I have a question regarding the performance of the .Net HttpWebRequest client (or WebClient, gives similar results). If I use HttpWebRequest to request an html page (in this case news.bbc.co.uk) and analyse the speed (using HttpAnalyzer) at which the response is read by the application, this is significantly slower than a browser (Firef...

Can BeginInvoke interrupt code already running on the UI thread?

Suppose I have some code which is running in the UI thread, which spawns a new thread to do work in the background, and then goes on to do UI work. When the background work is done, BeginInvoke is called from the new thread. If the UI work is still going on, will the callback given to BeginInvoke interrupt the UI work, or will it wait?...

Hosting CLR in Delphi with/without JCL - example

Can somebody please post here an example how to host CLR in Delphi? I have read similar question here but I cannot use JCL as I want to host it in Delphi 5. Thank you. EDIT: This article about hosting CLR in Fox Pro looks promising but I don't know how to access clrhost.dll from Delphi. Edit 2: I give up on Delphi 5 requirement. No...

Make SandCastle merge the all members page to the main type page

For each class in the project SandCastle creates (among others) two pages: the main page, named T_class_full_name, with the description, Syntax, Inheritance Hierarchy and See Also and the members page, named AllMembers_T_class_full_name, with Constructors, Methods, Fields, etc. Is there a way to merge these two together - with the me...

What causes System.BadImageFormatException when constructing System.Data.SQLite.SQLiteConnection

I've broken the code down to the smallest possible statement: Dim cn As System.Data.SQLite.SQLiteConnection And I get the following error when calling the code from a WinForm applicaiton: System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=d...

Exception Handling Dilemma

Working on existing code, I recently found smt like this: if(Config.ExceptionBehavior.DEBUG_EXCEPTIONS) { foo.Foo(); } else { try { foo.Foo(); } catch(Exception ex) { //whatever } } I am getting rid of this - but I do see some value in the driver of this kind of code: basically the guy who wrote this w...

response redirect from .ashx file

I have ashx file and I want to redirect from ashx to aspx page. Some solution? ...

Set roaming setting at runtime

Hi gurus In .net, is possible, at run-time, to specify if a user configuration setting should roam or not? Or is it possible to set this setting in the app.config file? ...

Recommend Profiler for C#

Hi I have a windows service and it turns out I have a System.OutOfMemoryException after some time. Can you recommend some tools that would detect a memory leaks. I don't know if there can be a memory leak in .NET since it uses a gargage collector. But I remember I used BoundsChecker for C++ applications where memory leaks are typical p...

How can I test for null arguments in the constructor of abstract class using rhino mocks?

I have a class like so: public abstract class ClassA<T> { protected ClassA(IInterface interface) { if (interface== null) { throw new ArgumentNullException ("interface"); } } } I want to write a test which verifies that if I pass null in the exception is thrown: [Test] [ExpectedExcep...

C# - Evaluate Excel Logical Formulas

I have an Application that need to evaluate Excel Logical Formulas and I use Excel DLL to do this, but DLL isn't it very efficient. .NET Framework (C#) has any Class that can make this Job? An sample I Provide this =IF(AND(10>=-5;10<0);(-3,8*10+335);IF(AND(10>=0;10<5);(1,4*10+335);IF(AND(10>=5;10<14,4);(-1,2766*10+348,38);IF(AND(10>...

Problem with IsIndeterminate while trying to put together a ProgressBar XAML template

Hello I´m creating a XAML template for the WPF ProgressBar. The following XAML code works fine if IsIndeterminate is set to False: <ControlTemplate x:Key="DefaultProgressBarTemplate" TargetType="{x:Type ProgressBar}"> <ControlTemplate.Resources> <SolidColorBrush x:Key="SolidBorderBrush" Color="#767676" /> <LinearGr...

.NET ContentInfo taking too long to process

The following code using ContentInfo(System.Security.Cryptography.Pkcs.ContentInfo) is really taking a long time to execute. Is there anything I can do to speed it up? byte[] fileContents = File.ReadAllBytes(fileName ); var contentInfo = new ContentInfo(fileContents); var signedCms = new SignedCms(contentInfo); signedCms.Decode(fileCo...

convert asp.net code to WebPart code issue

Hello everyone, I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net. I have the following code which works correctly in ASP.Net (aspx) and I want to implement the same function in a WebPart and deploy into a page of SharePoint publishing portal site....