.net

How can I invoke (web) Button.Click in c#?

As the title really, I'm in one part of my code and I would like to invoke any methods that have been added to the Button.Click handler. How can I do this? ...

MySQL Caching

Last night I added a parameter to a stored procedure in a mySQL database. I accessed it, messed up the parameter, and decided to remove the parameter again, for testing. Still minutes after re-creating the procedure without the parameter, my command object was still complaining about a missing parameter. Is this mySQL, MySQL/Connector...

Internals visible to Boo (Binsor)

I am using Castle Windsor for IoC and I want to use Binsor to define my configuration. I want to let my internals be visible to Boo. I have tried to mark my assembly with InternalsVisibleTo("Boo.Lang") but that didn't do the job. I have tried InternalsVisibleTo("Rhino.Commons") because I have noticed that the exception is thrown from wi...

Exception safety/handling with .Net HtmlTextWriter?

I am using a .Net HtmlTextWriter to generate HTML. try { htw.RenderBeginTag( HtmlTextWriterTag.Span ); htw.Write(myObject.GenerateHtml()); htw.RenderEndTag( ); } catch (Exception e) { GenerateHtmlErrorMessage(htw); } In this example, if an error exception is fired during myObject.GenerateHtml(), I will generate a nice er...

Get the name of a property by passing it to a method

Hello, StackOverflow user jolson had a very nice piece of code that exemplifies how one can register menthods without using strings, but expression trees here. Is it possible to have something similar for properties instead of methods? To pass a property (not the name of the property) and inside the method to obtain the property name? ...

What is the best way to download all of the WSDL files exposed by a WCF service?

What is the best way to download all of the WSDL files exposed by a WCF service? For example, the root WSDL file references the following other WSDL files: <xsd:import schemaLocation="http://localhost:80/?xsd=xsd0" namespace="http://tempuri.com"/&gt; <xsd:import schemaLocation="http://localhost:80/?xsd=xsd1" namespace="http://tempuri.c...

How to add CardSpace support to your ASP.NET application

Hi, I like the idea of CardSpace but unlike OpenID it seems like a real PITA to support it in your ASP.NET web application. I've found many examples, even a tutorial in one of the books I own... but it would seem a lot more is required than what they suggest. Changes to the server and such? Can someone tell me: What I need to confi...

Winforms .NET 2.0: How to draw a Png icon?

Note: Question http://stackoverflow.com/questions/220465/using-256-x-256-vista-icon-in-application deals with using a "Vista" icon as the application's icon. This question deals with manually painting a Vista icon. Note: Question http://stackoverflow.com/questions/281999/winforms-net-20-how-to-paint-with-the-proper-icon deals with paint...

Canceling request validation using HttpHandler on IIS 7

I have an application that has to deal with getting "special" characters in its URL (like &, +, %, etc). When I'm sending a request to the application using these characters (of course I'm sending them escaped) I'm getting "Bad Request" response code with the message "ASP.NET detected invalid characters in the URL". Tracing the request s...

How to post SOAP Request from .NET?

I have the SOAP request in an XML file. I want to post the request to the web service in .net How to implement? Thanks Senthil ...

Invoke() is blocking

From time to time my applications GUI stops redrawing. There a lot of threads that are firing all kinds of events (like timers or network data ready etc.). Also there are a lot of controls that are subscribing these events. Because of that, all the event handlers play the InvokeRequired/Invoke game. Now I figured out that when the GUI fr...

How to add items to a collection while consuming it?

Hi! The example below throws an InvalidOperationException, "Collection was modified; enumeration operation may not execute." when executing the code. var urls = new List<string>(); urls.Add("http://www.google.com"); foreach (string url in urls) { // Get all links from the url List<string> newUrls = GetLinks(url); urls.Ad...

ListView Empty Markup Text

Vista has introduced a new API to display a text in the list view control when it doesn't have any items. As the MSDN library states, I should process the LVN_GETEMPTYMARKUP notification. In the inherited ListView control the WndProc method is overriden: protected override void WndProc(ref Message m) { try { if(m.Msg == 78 /* WM_...

Is there a way to Deploy a .Net application without using an MSI?

I have a .Net program that I want to install on a terminal server. In the past I've created installer projects and generated an MSI. However, terminal servers require all users be bumped off before running an MSI and I want to avoid that. Is there a way to do an install without a MSI? Sometimes for some user accounts I can simply cop...

ADO.NET: Adding DataRelation to a DataSet; which is parent and which is child?

Consider an SQL Server table containing: ID ParentID Text === ========= ============= 1 (null) Product 2 (null) Applications 3 1 Background 4 1 Details 5 2 Mobile i fill a SqlDataSet with the table, and now i want to add the Parent-Child relation to the DataSet: public DataRela...

What is a .NET proxy object in the Inversion of Control / Aspect-Oriented sense?

What is a proxy object in the Inversion of Control / Aspect-Oriented sense? Any good articles on what a proxy object is ? Why you would want to use one ? And how to write one in C# ? ...

How to test a remoting connection (check state)

I have an object created in a host application and can accecss it remotely using remoting, is there any way I can test the connection to ensure it is still "alive"? Maybe an event I can use that fires if the remoting connection gets disconnected, or some property that can tell me the state of the remoting connection. Is there something ...

How to Pass MySQL null parameter on DbCommand in Enterprise Library.

I'm trying to pass a null value for the first parameter in the code below, but MySQL complains that Incorrect number of arguments for PROCEDURE myProc; expected 2, got 1 When I manually call the procedure with the first argument as null, it works, but when EmptyAsNullStartsWith(employeeNumberText.Text) returns null, it complains. ...

Regular Expression to validate hex string

Hi, I'm using this simple regular expression to validate a hex string ^[A-Fa-f0-9]{16}$ as you can see I'm using a quantifier to validate that the string is 16 chars long, I was wondering if I can use another quantifier in the same regex to validate the string length to be either 16 or 18 (not 17). Thanks in advance :) ...

Raise LostFocus event on a control manually. C#

Hi I have a bunch of controls (textbox and combobox) on a form with toolstripcontainer and toolstripbuttons for save, cancel etc for edits. We are using .Net 3.5 SP1 There is bunch of logic written in control.lostfocus and control.leave events. These events are not being called when clicked on the toolstrip buttons. Is there a way to...