.net

How to trace WCF serialization issues / exceptions

Hi I occasionally run into the problem that an application exception is thrown during the WCF-serialization (after returning a DataContract from my OperationContract). The only (and less meaningfull) message I get is System.ServiceModel.CommunicationException : The underlying connection was closed: The connection was closed un...

System.IO.Path or equivelent use with Unix paths

Is it possible to either use the System.IO.Path class, or some similar object to format a unix style path, providing similar functionality to the PATH class? For example, I can do: Console.WriteLine(Path.Combine("c:\\", "windows")); Which shows: "C:\\windows" But is I try a similar thing with forward slashes (/) it just reverses t...

Does BeginReceive() get everything sent by BeginSend()?

I'm writing a program that will have both a server side and a client side, and the client side will connect to a server hosted by the same program (but by another instance of it, and usually on another machine). So basically, I have control over both aspects of the protocol. I am using BeginReceive() and BeginSend() on both sides to sen...

.NET: Strange behaviour of double.Equals() when boxing.

What's going on here? int zero = 0; double x = 0; object y = x; Console.WriteLine(x.Equals(zero)); // True Console.WriteLine(y.Equals(zero)); // False ...

c# resize window over display resolution

I am total newbie in .Net programming so be patient, please ;-). I have problem with resizing window. I want to resize from my app other app's window and take screenshot of it. I do resizing based on this example: http://blogs.geekdojo.net/richard/archive/2003/09/24/181.aspx. But I have a problem. I work on a laptop with 1024x640 pixels...

Implementing N-tier structure in .net

Hi friends, my requirement - suppose I have three classes namely Employee, Customer and Department. Employee contains attributes id, name, dept. Customer contains id and name. Department contains id and name. Now all three class have common functionality i.e. create, update and delete. I want to implement these functions using an interfa...

How do I setup a Criteria in nHibernate to query against multiple values

I want to query for a set of results based on the contents of a list, I've managed to do this for a single instance of the class Foo, but I'm unsure how I would do this for a IList<Foo>. So for a single instance of the class Foo, this works: public ICriteria CreateCriteria(Foo foo) { return session ...

How to convert a .NET WebService-Method-Result (Soap) into its original datatype?

Hello everyone. I have two "identical" webservices (Soap) on two different servers. Don't ask why :-) WebService-1 decides if it handels the request itself or if it passes the request to WebService-2. If so, the response of WebService-2 should directly be returned from WebService-1. The response datatype is complex and self defined. W...

can we assign object value to the label?

I have a label for that i have to assign object value which is returned by stored procedure.my code as following object returnvalue; SqlConnection con = new SqlConnection("Data Source=vela21; Initial Catalog=MilkDb;Integrated Security=True"); con.Open(); string sa; sa = textBox1.Text; SqlCommand cmd = new SqlC...

Accessing protected members of .NET type in Iron Python

I have a .NET type 'MyClass' with a protected method that takes in an out parameter. For example: protected bool MyMethod(out string value) I am able to call this method on a 'MyClass' object created in Iron Python script. But however, the out variable 'value' is 'None' even if it is assigned some value in the method. Now if I make i...

Datatype attribure implementation

Hi, In my property i need a email address validation. But [Datatype(DataType.EmailAddress)] was not working. How to rectify the same. any use full links welcome Thanks, Jo ...

Multi-threaded downloader in C# question

Currently I have multi-threaded downloader class that uses HttpWebRequest/Response. All works fine, it's super fast, BUT.. the problem is that the data needs to be streamed while it's downloading to another app. That means that it must be streamed in the right order, the first chunk first, and then the next in the queue. Currently my dow...

Awkward looking uses of Contract.ValueAtReturn()

I am designing a method that will add an element to an internal list. The structure of the class is something along the lines of: class MyCustomerDatabase { private IList<Customer> _customers = new List<Customer>(); public int NumberOfCustomers { get { return _customers; } } public void AddCustomer(Customer customer) {...

How elevate and get admin rights on-demand in a .NET application?

I have an .NET application which is run with default rights as the current user, then at some point I need to perform an action which requires admin rights. How can I get admin rights on-demand in a .NET application? Requiring that the application is run with admin rights from the beginning is not appropriate as it may be that such ac...

Return HTTP 404 when MVC2 view does not exist

Hi, I just need to have the a small CMS-like controller. The easiest way would be something like this: public class HomeController : Controller { public ActionResult View(string name) { if (!ViewExists(name)) return new HttpNotFoundResult(); return View(name); } private bool ViewExists(string na...

Smooth Text On Glass

Hi All I have seen many other samples out there that draw smooth text on glass. But I can't use them. I need every single label that gets added at runtime to be smooth. I can't just "draw" text onto the screen. Is this at all possible, and are there and sources around? Thank you ...

How to discover role instances in Azure?

The code below only prints one instance id per instance even though I'm running 4 instances. Is this a bug in development fabric or this is how it is supposed to be? public override void Run() { foreach (RoleInstance roleInst in RoleEnvironment.CurrentRoleInstance.Role.Instances) { Trace.WriteLine("Instance ID: " + roleI...

ERPConnect (Theobald Software): RFC authorization

I want to call a remote SAP function via ERPConnect (Theobald Software): R3Connection con = new R3Connection("host", 1, "user", "pw", "EN", "700"); con.Open(false); RFCFunction func = con.CreateFunction("FUNCTION_NAME"); Here I get the folliwing exception: User ... has no RFC authorization for function group RFC1 Is it generally neces...

.NET Application broken on one PC, unhandleable exception

Hello people. I have a .NET 2.0 application with nothing fancy in it. It worked until yesterday on every PC I installed or copied it to, no matter if 2.0, 3.0, 3.5 or 3.5 SP1 was installed, no matter if it was Win2000, XP or even Win7 (in total 100+ machines). Yesterday I did my normal installation procedure and wanted to start it one ...

How can I convert my Stream (image data) back into a file

I have a WCF restful service that I'm trying to upload an image to. I have a very basic metod that accepts a stream as it's only parameter and is defined in the contract as: [OperationContract] [WebInvoke(UriTemplate = "ReviewImage", BodyStyle = WebMessageBodyStyle.Bare, Method = "POST")] ReviewImage UploadImage(Stream data); I'm act...