.net

How can I make the xmlserializer only serialize plain xml?

I need to get plain xml, without the <?xml version="1.0" encoding="utf-16"?> at the beginning and xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" in first element from XmlSerializer. How can I do it? ...

LINQ to XML: How to clone nodes while retaining annotations?

Try this: var doc1 = XDocument.Load(@"C:\any.xml", LoadOptions.SetLineInfo); var doc2 = new XDocument(doc1); doc2 no longer has any line number information. Digging in with Reflector, I can see that when the nodes are cloned from doc1 to doc2 this does not preserve the annotations on the XObject base type, which includes the line numb...

Why don't statements that don't do anything throw an exception (or warn the developer)?

I've been bitten a couple of times by statements in VB.NET (not sure if this effect exists in C#) that appear to be self-referencing, but when they're executed, they don't actually do anything because they require a target and one isn't provided. For example: Dim MyString as string = "String to test" ' Neither of these lines do anythin...

Bubbling Events not Occurring

Hello All, In the code below, I am seeing the tunneling events occurring but am not seeing the corresponding bubbling events occurring. Why might this be? Thanks, Dave <Window x:Class="TestRoutedEvents.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml...

Calling a web service from a terminal services computer

I've got a windows service I've created to run a terminal service computer. At one point it uses .NET to call out to a web service ("ReportPdfGenerator") method "GetPdf": ReportPdfGenerator.ReportPdfGenerator test = new ReportPdfGenerator.ReportPdfGenerator(); ... data = test.GetPdf(reportId, paramList.ToArray(), false); Un...

C# and .NET: TextBox.Text is not always actual?

Hello. As always, i'm forced to use technologies i'm not familiar with :(. For now it is .NET framework with by C#. It is a simple GUI application with some text fields and the almighty TextBox with the 'Text' property. It seems that the content of this 'Text' property is not always actual O_O. For example, if i change text and click ...

Static Abstract methods in C#

I know it's a tautology to have a static abstract method, but how can I do something like this: Base, abstract class: abstract class QTimerDatabaseObject { public static abstract QTimerDatabaseObject createFromQTimer(DataRow QTimerRow); public abstract void saveRow(); } Sample Implementation (Inside a User class that extends...

In VS2010 Beta 2, the Web Report Viewer does not display the content of the report

In VS2010 Beta 2, the Web Report Viewer does not display the content of the report, whether I use Local or Remote mode. It only display the following "disabled" bar [image] The report I created works fine in the Report Server. Here is the code for displaying the report: ReportViewer1.ProcessingMode = ProcessingMode.Remote; ...

FTP Upload multiple files without disconnect using .NET

I'm uploading multiple files using FtpWebRequest. But for every file I'm opening and closing a connection. How can I upload multiple files using the same connection? Like a ftp client application, connect using username and password, change directory, upload file1, upload file2, upload file3, disconnect. ...

101 Rx Examples

EDIT: Thanks for the link to the wiki, I think that since its already started there, its easier to go there to check it out. However the question here is also good, so people who are not around the msdn forums get to know about the wiki and where it is. Short Question: Do you have a Sample of Rx Code that could help people understand i...

Naming the Namespace

I am having an issue trying to figure out how to appropriately name my namespace. My namespace is currently: <CompanyName>.<ProductName>.Configuration However, using "Configuration" conflicts with: System.Configuration To make matters worse, I also have a class called ConfigurationManager. I know I could change it to something li...

When would I use my own RouteHandler?

I understand that in ASP.Net DynamicData (and maybe regular ASP or MVC) I can provide my own RouteHandler routes.Add(new DynamicDataRoute("{table}/{action}.aspx") { RouteHandler = new CustomRouteHandler() }); public class CustomRouteHandler : DynamicDataRouteHandler { public override IHttpHandler CreateHandler(DynamicDataRoute...

How to make my own Attribute tag?

Hi I am using asp.net mvc 1.0. I know asp.net mvc has a couple attribute classes such as "AuthorizeAttribute", ActionFilter? and I think there is like 2 more. So I have made my own AuthorizeAttribute but I am not sure if this is the right one to use again or if I even need to inherit any of these built in classes. What I am trying to...

How can I find which object in ASP.NET can't be serialized?

I'm getting the following error in my application: Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is ...

How to Regular Expression match not having a constant at the end of a string (.net validator)

The item referenced in this question does not seem to work for me. I'm using the Regular Expression validator in .net I need to pass validation if the input field does NOT look like this "bagdfsdf -CONST" When I use "(?>!-CONST)$" and ".*(?>!-CONST)$" the regular expression validator never allows it. If I have -CONST at the end or no...

How should I set up a user control to fire events of its children as if they were its own?

In other words, I have a UserControl that has, for example, a label on it. Well, when the client registers with the MouseMove event of the UserControl, it should get that event whether the mouse is over the label or somewhere else on the UserControl. What would be the best way to set this up? C# ...

GUI and windows service communication

I know since Vista, that C# can't hook a UI form directly to the windows service. This was stated on the Microsoft Site. My question in this regard is: "What is the best mode of communication from a UI to the service?" I have heard of Remoting, Web services, and direct TCP. Are there other methods? How do they rank against the previ...

How do I stop NCover from hijacking every .NET assembly?

Hey all, I know that this, strictly speaking, is not a programming question, but I think the only people who can answer it are programmers. I've never had this happen before, but on one workstation where I have NCover installed, it seems to be intercepting every .NET assembly I load. For example, after installing it, suddenly it takes ...

How to extract XML from the WinForms WebBrowser control?

I want the same as WebBrowser.Document.Body.InnerHtml, but as an XML representation. ...

Launching C# .Net application from browser. Possible?

The greatest example I can think of is the Google Chrome installation. I remember one other application launching that same way. Can't remember what it was. I'm not implying that it was built in C# or even .Net. It is possible somehow. It's been done. Just wondering how. ...