.net

Alternative way of implementation of a code

The title is not exactly meaningful, but I am not share what else to name it. I wrote a TOC Generation code sometime later. Based on this I was writing code to check for duplicates also. The code is as follows curNumber = getTOCReference(selItem.SNo, IsParent); CheckForDuplicates(curNumber, IsParent,out realTOCRef); curNumber = realTOC...

Static and default constuctor

A non static class can have static as well as default constructor at the same time. What is the difference between these two constructors? When shall I go for only static or static with default constructor? ...

.NET DataGridViewLinkColumn flicker on hover on link

There's a flickering issue when using a DataGridViewLinkColumn. If you hover on a link, it gets redrawn with a flicker. Doublebuffering, or setting options like LinkBehavior: "NeverUnderline" doesn't seem to have any effect. What's causing it and can it be fixed ? ...

Paypal adaptive payment API call with C# .NET? Preferably with WebServices

Okay I might be entirely off track now but here goes: Our "webshop" offers two functions, buying a specific product and selling it back to us. Back-end handles if the user can sell or not. I've decided to use Paypal's adaptive payments for this one as it seems the way to go doing these kinds of transactions. I've never implemented any...

Different Assembly Name for Each Platform Target

I need to generate different assembly names depending on the platform target. For example, I have a console application "bob.exe". Instead of building for AnyCPU, I need to build explicitly for x86 and x64 and thus want "bob32.exe" and "bob64.exe". The Application tab in Visual Studio 2010 project options disables the Platform combobo...

How to deploy ClickOnce .Net 3.5 application on 3.0 machine

I have .Net 3.5 SP1 WPF application which I'm successfully deploying to client computers using ClickOnce. Now I got new requirement - one of our clients need to run the application on machines equipped just with .Net 3.0 and it's entirely impossible to upgrade or install anything on the machines. I already tried to run the 3.5 applicatio...

ODBC Connection Pooling

I have inherited a suite of .Net c# applications from a developer which talk to an Informix database on a unix server. Instead of using the usual practices for managing the database connections (disposable pattern / "open late / close early"), the code seems to open one ODBC connection when each app loads and doesn't close it. Is there...

using dynamic as type of MVC strongly typed view

Hi, I have a page for creation of dynamic entities. <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> ... I have two actions: public ActionResult Create() { dynamic model = ... return View(model); } [HttpPost] public ActionResult Create(dynamic(1) entity) { ... } Well, th...

DataSets to POCOs - an inquiry regarding DAL architecture

Hello all, I have to develop a fairly large ASP.NET MVC project very quickly and I would like to get some opinions on my DAL design to make sure nothing will come back to bite me since the BL is likely to get pretty complex. A bit of background: I am working with an Oracle backend so the built-in LINQ to SQL is out; I also need to use p...

question about System.Net

hi all. when i use some code like this: System.Net.WebClient objClient = new WebClient(); string url = "http://google.com"; objClient.DownloadString(url); it takes some seconds to connection stablished and downloading starts... i reinstall my windows yesterday. before yesterday i havent this problem. some times when i reinstall my wi...

Calling CryptUIWizDigitalSign from .NET on x64

I am trying to digitally sign files using the CryptUIWizDigitalSign function from a .NET 2.0 application compiled to AnyCPU. The call works fine when running on x86 but fails on x64, it also works on an x64 OS when compiled to x86. Any idea on how to better marshall or call from x64? The Win32exception returned is "Error encountered d...

Can I use Visual Studio 2010 and not upgrade to .NET Framework 4.0?

I have many Visual Studio 2008 web projects targeted at the .NET Framework 3.5. I want to start using Visual Studio 2010, but the .NET Framework 4.0 isn't very well supported by web hosting companies just yet. It seems to make sense to stick with the .NET Framework 3.5 for now. If I open my projects in Visual Studio 2010 and leave the...

WebClient.Download returning 0 bytes

Hi I'm having a problem downloading data using WebClient.Download. It always returns 0 bytes, even though I know from FTPing in another program, or looking at WebClient.ResponseHeaders, that the file is 1731 bytes in length. This occurs using FtpWebResposne too. The only anomalous clue is that the Encoding of the client response is set...

Which of the two exceptions was called?

If I have a routine that can throw an ArgumentException in two places, something like... if (Var1 == null) { throw new ArgumentException ("Var1 is null, this cannot be!"); } if (Val2 == null) { throw new ArgumentException ("Var2 is null, this cannot be either!"); } What’s the best way of determining in my calling procedure w...

ComponentResourceManager.GetObject( "$this.Icon" ) throwing Invocation Exception on WinXP

This is generated code on a winform app's InitializeComponent() implementation (from the code-behind *.Designer.cs file). This code works on Vista/7, but on XP it blows up at runtime. I have a custom Icon added to the form. It was initially a png file. Suspecting that XP couldn't handle that format (the inner exception is something a...

Unit Testing User Interface. What is an effective way ?

I have an accounting & payroll client/server application where there are several input form with complex data validation rules. I am finding an effective way to perform unit testing of user interface. For complex validation rules I mean: "Disable button X if I Insert a value in textfield Y" "Enable a combobox if I insert a value in a...

Validate a single property with the Fluent Validation Library for .Net

Can you validate just a single property with the Fluent Validation Library, and if so how? I thought this discussion thread from January of 2009 showed me how to do it via the following syntax: validator.Validate(new Person(), x => x.Surname); Unfortunately it doesn't appear this works in the current version of the library. One other ...

Can I create a custom roleprovider through a WCF service?

I have a web application that accesses a database through a wcf service. The idea is to abstract the data from the web application using the wcf service. All that works fine but I am also using the built in roleprovider using the SqlRoleManager which does access the aspnetdb database directly. I would like to abstract the roleprovider...

how to monitor the program code execution? (file creation and modification by code lines etc)

My program is about triggering XSL transformation, Its fact that this code for carrying out the transformation, creates some dll and tmp files and deletes them pretty soon after the transformation is completed. It is almost untraceable for me to monitor the creation and deletion of files manually, so I want to include some chunk of cod...

SAML Authentication for a .NET Application

It should be possible to use SAML to authenticate users for any type of application (according to the spec), but the examples I have seen are cookie-based ASP.NET web-sites. Does anyone know of an example authenticating users for, say, a Win Forms app (not using cookies)? ...