.net

Logging custom classes through WebService using NLog.

Problem is as follows: On log event I want to send my custom object (lets say LogMessage that wraps in some way logging event) to my web service. Could work like appenders in log4net, or is there this kind of thing in Nlog btw? Or how do I do this NLog way? Note: I'm using WebService target wrapper (if this helps in any way). ...

How to prevent duplicate code generation when placing winforms event handlers in other partial files

In a winforms application I have a MyForm.cs that starts to get quite large. To solve this I have created a new file(MyForm.LeftPanel.cs) using partial class of the MyForm class with a subset of the GUI functionality. However once in a while, not always, when I go into the designer all event handlers that I have moved to MyForm.LeftPane...

What's are the benefits of using Web.config scheduled tasks over for example a Windows scheduled task

We are thinking of ways to get our scheduled tasks centralized as much as possible by dragging alot of tasks from website specific web.config files to one Windows schedules task. I can imagine that this has some negative consequences, but I want to list them so I can make myself a good explanation of what will work best. We have differen...

put an exception to an exception to get the next exception on .net

I use thrown in visual studio 2005 while debugging a project to get the possible error. But when I do it, it stops with an green arrow pointing the error line that is happening, but I want to skip that error to get the next possible error. How can I skip and set the yellow arrow to make it yellow and let it to go on to the part of th...

outllok express commanline attachment

Dear Friends, I need to develop a utility which opens the outlook express new mail window with attachment. I need to invoke this from command line i have tried various things please help me.... ...

C#: How to listen to a running IceCast-Server?

I want to listen to a running IceCast-Server, but it keeps getting 0 bytes only (although it gets a connection to IceCast). What am I doing wrong? Here is the code I use: tcpClient = new TcpClient(); tcpClient.Connect(IPAddress.Parse("127.0.0.1"), 8000); HandleClientComm(tcpClient); And here HandleClientComm: private void Hand...

.net library to draw shapes images text etc, using GDI+

A stupid question here: is there such a library to do these stuff? I want a more advanced library than system.drawing namespace. ...

How to change the Public token of the assembly

I have 2 dlls. One dll is refering to the another one. I checked the mainfest of first dll and found it is referncing to the 2nd one with some specific token key. But I checked the token of second assembly and found that it has some diffrent public token. So somehow I missed the correct 2 second assembly. So I want to know is there a w...

CopyFileEx in windows 7

Hi to all. I'm trying to use function CopyFileEx from kernel32.dll in Windows 7 using .NET interop. MSDN says: If lpProgressRoutine returns PROGRESS_STOP due to the user stopping the operation, CopyFileEx will return zero and GetLastError will return ERROR_REQUEST_ABORTED. In this case, the partially copied destination file is left inta...

DataGridView sample binding issue

I need to add a variable pair list in a form (Name-Value). I decided to set it in a datagridview, and use simple binging to manage it (.NET 2): public class EventParameter { private string name; public string Name { get { return name; } set { name = value; } } private string value; public strin...

OpenXML: Read text between two document fields using OpenXML SDK

Hi, I'm new to programming with the OpenXML SDK and I've tried excessively to locate and read text that is between two document fields, but never really succeeded. There are tons of samples and tutorials on the web about almost everything you can think of doing with the OpenXML SDK, from setting watermarks to doing merge mail, but not o...

Reading from configSection attribute of type "Type"

I've a section like this <mySection type="Namespace.MyClass, AssemblyName" /> in my code I need to create an Instance of MyClass, so what I do is something like that: string type = GetMySectionType(); // "Namespace.MyClass, AssemblyName" var typeParts = type.Split(','); var className = typeParts[0].Trim(); var assemblyName = typePar...

How to implement decision tree with c# (visual studio 2008) - Help

Hey, I have a decision tree that i need to turn to a code in C# The simple way of doing it is using if-else statements but in this solution i will need to create 4-5 nested conditions. I am looking for a better way to do it and so far i read a little bit about rule engines. Do you have something else to suggest for an efficient way t...

Unable to logout from ASP.NET MVC application using FormsAuthentication.SignOut()

I am trying to implement Logout Functionality in ASP.NET MVC. I use Forms Authentication for my project. This is my Logout code: FormsAuthentication.SignOut(); Response.Cookies.Clear(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, FormsAuthentication.FormsCookieName, DateTime.Today...

How to create a CheckBoxListFor extension method in ASP.NET MVC?

Hi, I know there is a ListBoxFor extension method among the ASP.NET MVC Html helper extension methods, but I always thought that a checkbox list is more user-friendly than a list box. There was a very convenient CheckBoxList control in good old WebForms, but obviously that is out of the picture now. The question is, why is there no wa...

SetFetchMode call ignored

I have a problem with SetFetchMode call in Criteria API in following query: DetachedCriteria.For<User>() .Add<User>(u => u.Status == UserStatus.Live) .CreateAlias("UniqueId", "uid") .CreateAlias("Companies", "comp") .Add(Restrictions.Disjunction() ...

Call method in existing Com Application from my .NET application

There is a scenario I'm interested in. User runs COM based application in a separate window, I want my C# application to manipulate that application through COM calls. I've found COM interface I'm interested in and VisualStudio has successfully generated wrapper (MyApp.interop). So I can write something like new Interop.MyApplication() ...

How to restore sql server history-files with vb.net?

How can I restore history-files of a SQL Server 2005? ...

How to enumerate per-Forest Active Directory domains in C# ?

This code enumerate Active Directory domains, if the mahine on which is running is part of the forest. public static ArrayList EnumerateDomains() { ArrayList alDomains = new ArrayList(); Forest currentForest = Forest.GetCurrentForest(); DomainCollection myDomains = currentForest.Domains; foreach (Domain objDomain in my...

How to force a synchronous call to a web service

public string CreateOrder(string purchaseOrder) { using (MyWebService.CreateService service = new MyWebService.CreateService()) { string orderCode = service.CreateOrder(purchaseOrder); return orderCode; } } I've added a web service reference to the domain layer of an ASP.NET web app. This generates the two...