.net

How do I use request-response using HTTP libraries in C#.NET/Mono

Right now I have been trying to use Launchpad's API to write a small wrapper over it using C#.NET or Mono. As per OAuth, I first need to get the requests signed and Launchpad has it's own way of doing so. What I need to do is to create a connection to https://edge.launchpad.net/+request-token with some necessary HTTP Headers like Conte...

How to ensure an asmx web service only gets called once at a time?

I have an asmx web service that should only be allowed to respond to 1 client at once. In otherwords if the service is getting called by client A, and server B calls, I would like B to pend until A is finished then B can get serviced. If this is too complicated then at bare minimum calls from B should fail with a user defined error d...

MouseOver Trigger firing on ContextMenu with overridden ControlTemplate. Where is it coming from?

I have this very simple ControlTemplate: <ControlTemplate TargetType="{x:Type ContextMenu}"> <Border Name="Border" Background="{StaticResource BlueBackground}" BorderBrush="LightBlue" CornerRadius="10" ...

ImageButton which allows Auto-Size the image

Hi, I search a button control with a image, which auto size the image - the normal button don't do this. It's C#.Net 2.0. E.g.: Button is 200x 50px and the image is 800x100, I will resize the Image that is little left near the text of the button. With a Pic-Box I can do this. But when I lay a picBox over the button its very ugly becau...

Mono Project: Why is mono faster than .NET?

I am surprised to observe that mono is faster than .NET. Does anyone know why is it so? I was expecting mono to be slower than .NET but wasnt the case atleast with my experiments. I have a windows xp laptop with .NET framework. I am running CentOS on vmware vmplayer on top of windows xp. I wanted to try mono. So grabbed the Mono 2.6.1 s...

my program keeps hold of files it's written using GDI+

private void save(Rectangle src, Rectangle dest, string fName, int width, int height, Bitmap file) { Bitmap result = new Bitmap(width, height); Graphics g = Graphics.FromImage(result); g.DrawImage(file, dest, src, GraphicsUnit.Pixel); result.Save(fName); g.Dispose()...

Singleton pattern in web applications

I'm using a singleton pattern for the datacontext in my web application so that I dont have to instantiate it every time, however I'm not sure how web applications work, does IIS open a thread for every user connected? if so, what would happend if my singleton is not thread safe? Also, is it OK to use a singleton pattern for the datacont...

How append data to a binary file?

I have a binary file to which I want to append a chunk of data at the end of the file, how can I achieve this using C# and .net? also are there any considerations to take when writing to the end of a binary file? thanks a lot for your help. ...

How to add support for a new language in FlashDevelop?

I am interested in making a plugin for FlashDevelop to add support for another language. I am not too sure where I should start. So any starting points, hint, tips, or advice would go down well. There is a Plugin Development article on the FlashDevelop Wiki, but the section about adding support for new languages is just a "TODO". So thi...

how to get the oldest file in a directory fast using .NET?

I have a directory with around 15-30 thousand files. I need to just pull the oldest one. In other words the one that was created first. Is there a quick way to do this using C#, other than loading them into a collection then sorting? ...

Retrieve System.ComponentModel.DataAnnotations.DisplayAttribute properties from ViewModel-bound Controls using code

Hello, I've noticed that the SL3 Validators automatically uses the properties from DisplayAttribute when creating validation messages. I'm interested in any suggestions on how to extract this information from a control's binding using code. I've included an example: ViewModel code: [Display(Name="First Name")] public string FirstName ...

Equals method of System.Collections.Generic.List<T>...?

I'm creating a class that derives from List... public class MyList : List<MyListItem> {} I've overridden Equals of MyListItem... public override bool Equals(object obj) { MyListItem li = obj as MyListItem; return (ID == li.ID); // ID is a property of MyListItem } I would like to have an Equals method in the MyList objec...

Tree View / File View Control for C#

I have been looking for a C# tree control for displaying a file system that has the following capabilities: Select a starting directory. I don't always want to start at a "default" top directory level. The ability to grab an event when the user double clicks on a file in the tree. I want to handle opening the file within my applicati...

Has anyone used the Win32 API function CredWrite in .NET?

I'm trying to use CredWrite, but get an ERROR_INVALID_PARAMETER 87 (0x57) error. The intent is to have a secure place to save the user's password for my .net WPF application. And my code: public class CredMan { private const string TARGET_PREFIX = "myappname:"; public static void SavePassword(string username, string password)...

.net question - where are the DefaultCredentials stored/accessed from for a WinForms v3.5 app?

Hi, Where are the DefaultCredentials stored/accessed from for a WinForms v3.5 app? That is if I am using the settings for defaultProxy for my Winforms v3.5 application, and set a proxy server address here, exactly where does/can the username/password come from? Or in other words where does the framework source the "default credentials...

Process Memory limit of 64-bit process

I currently have a 32-bit .Net application (on x86 Windows) which require lots of memory. Recently it started throwing System.OutOfMemoryException's. So, I am planning to move it to a x64 platform as 64-bit process. So will this help with the out of memory exceptions. I was reading this article from MSDN Memory limits for Windows So, ...

Why does Sharepoint 2010 Web Reference work, but Service Reference does not

Sharepoint is setup to use NTLM authentication. When I reference http://myserver/Sites/Ops/_vti_bin/Lists.asmx?WSDL as a Web Reference, I can call the methods and get valid responses. When I reference the same url as a Service Reference, the server throws an exception when calling methods. My account is admin on the Sharepoint Farm. ...

Can someone help me recall what this framework / technology is called?

When I started to learn about WPF and MVVM recently, I came across some sort of framework or technology in .NET that made it really easy to request a service of some kind. In my particular case, I've got an assembly that handles writing application preferences to an XML file, and I want to let all of my assemblies in the larger applicat...

validation on telephone numbers?

hi, in my application i want to validate the telephone numbers, how can i write regular expression for telephone numbers like.. 040-23357399 or 04023357399 91-40-23357399 or 914023357399 08518-2814655 or 085182814655 91-8518-2814655 or 9185182814655 this is my phone numbers how can i write the expression for this ...

How to access and work with XML from API in C#

My goal is to pull XML data from the API and load it to a sql server database. The frist step I'm attempting here is to access the data and display it. Once I get this to work I'll loop through each row and insert the values into a sql server database. When I try to run the code below nothing happens and when I paste the url directly int...