.net

Web service does not accept input

I am working on a simple .Net 4.0 webservice. I created one method, which accepts a string input. I run the project in Debug mode so a page opens in my browser where I can enter an input and invoke the method of the service. Unfortunately I am getting the following error: System.Web.HttpRequestValidationException: A potentially dangerou...

Ordered List of Keyvaluepairs?

Is there an collection in .net that allows the storing KeyValuePair<string, string> that keeps the order of inserting? OrderedDictionary looked promising, but seems to be rather lacking. Now I'm looking into IOrderedEnumerable>, but I can't seem to find any implementation except for ISortedDictionary, but that's not what I want. No sorti...

Very Different Execution Times of SQL Query in C# and SQL Server Management Studio

I have a simple SQL query that when run from C# takes over 30 seconds then times-out every time, whereas when run on SQL Server Management Studio successfully completes instantly. In the latter case, a query execution plan reveals nothing troubling, and the execution time is spread nicely through a few simple operations. I've run 'EXEC ...

ASP.NET web control with the same ID

On an ASP.NET page, if the ASP.NET elements like <asp:Texbox ID="Textbox1"> appears in more than one place, are they the same Textbox object or are they different objects with the same name "Textbox1"? If the same, "why won't it cause any conflicts?" E.G. ...

How can i solve "0 " value try to get length value?

if i try to add int value into array with string length Whole data is "0" why? and how can solve it? for (int j = 0; j < dTable.Columns.Count; j++) for (int i = 0; i < dTable.Rows.Count; i++) { mycounter[i] = dTable.Rows[i][j].ToString().Length; } it is not related...

Preserve Font Size when scaling a Drawing

I do the following when drawing: Matrix m = new Matrix() m.Scale(_zoomX, _zoomY) e.Graphics.Transform = m e.Graphics.DrawLine(...) ' line representation ' e.Graphics.DrawString(...) ' line text ' Now, the text became also scaled. Is it possible to avoid it? ...

Can I temporarily prevent manual changes to a DataGridView from updating the underlying data source?

I tried to find another question like this one, since it certainly seems like something that may have been asked before; but I couldn't find it. Basically, I've got a DataGridView, which is bound to a BindingList<T>. I understand that in general, data binding is very nice and saves a lot of (our -- developers') time. However, there is a...

FileStream.Read(...): Will I ever get a nibble rather than byte?

Hi All, I'm doing a number of bitwise operations on an array of bytes in C#. I'm obtaining the array by calling FileStream.Read. I just realized that I'm not sure what would happen if a file had a bad byte or corrupt byte in it somewhere. For example, maybe a nibble is chopped off of the end or something like that. What would the Fi...

Why choose .Net 4.0 over previous versions?

Possible Duplicate: New Cool Features of C# 4.0 What are the major advantages of using .Net 4.0 over prior versions of the framework? ...

WPF Storyboard delay in playing wma files

I'm a complete beginner in WPF and have an app that uses StoryBoard to play a sound. public void PlaySound() { MediaElement m = (MediaElement)audio.FindName("MySound.wma"); m.IsMuted = false; FrameworkElement audioKey = (FrameworkElement)keys.FindName("MySound"); Storyboard s = (Storyboard)audioKey.FindResource("MySound.wma"); s.Be...

OCR replacement for MODI

I have recently been using the builtin OCR functionality of MODI to capture text of a window. I use the window handle and could get text at any region or I could get the coordinates of specific text that I want to search for. It looks like MODI has been depricated, and it isn't included in office 2010 which we're now using, so I need...

Web service reference location?

I have a Visual Studio 2008 solution that's currently consisting of three projects: A DataFactory project for Business Logic/Data Access. A Web project consisting of the actual user interface, pages, controls, etc. A Web.Core project consisting of utility classes, etc. The application requires consuming a web service. Normally I'd ad...

Path to the executable of a windows service.

How can I get the path to the executable of a specific windows service from another program ? Unfortunately the class ServiceController (System.ServiceProcess) doesn't provide a method or property for that ! ...

Migrating .NET/MySQL app. to DB2

I want to migrate my existing desktop Windows .NET 3.5 app. that uses MySQL as backend to DB2 Express C. I downloaded IBM Migration Toolkit to migrate the database. I have further queries: How accurate is IBM Migration Toolkit? Are there any issues? For the application, just changing the connection string will do or something else? ...

Set a default value to a property

Is it possible to set a default value without the body of a property? Preferably with annotations. [SetTheDefaultValueTo(true)] public bool IsTrue { get; set; } [SetTheDefaultValueTo(false)] public bool IsFalse { get; set; } public void Something() { var isTrue = this.IsTrue; var isFalse = this.IsFalse; } ...

What is the C# static fields naming convention?

I have recently started using ReSharper which is a fantastic tool. Today I came across a naming rule for static fields, namely prefixing with an underscore ie. private static string _myString; Is this really the standard way to name static variables? If so is it just personal preference and style, or does it have some sort of lower ...

WCF high instance count: anyone knows negative sideffects?

Hi there! Did anyone experience or know of negative side effects from having a high service instance count like 60k? Aside from the memory consumption of course. I am planning to increase the threshold for the maximum allowed instance count in our production environments. I am basically sick of severe production incidents just because ...

Improving methods with variable parameters using .NET Generics

I have a lot of functions which are currently overloaded to operate on int and string: bool foo(int); bool foo(string); bool bar(int); bool bar(string); void baz(int p); void baz(string p); I then have a lot of functions taking 1, 2, 3, or 4 arguments of either int or string, which call the aforementioned functions: void g(int p1) ...

WCF Service in Seperate Assembly

What is the correct way to create a WCF service in separate assembly but then expose its endpoint through a Web Project in the same solution? ...

Snap to grid in millimeters on a panel?

I have a panel. I need to represent it in WYSIWYG. Now, when drawing on it, is possible to draw using millimeters instead of pixels. graphics.PageUnit = GraphicsUnit.Millimeter graphics.DrawRectangle(pen,rect) Is it possible to position the controls(buttons, textboxes) also in millimeters, in order to get a "real" paper image of the...