.net

Big files uploading (WebException: The connection was closed unexpectedly)

UPDATED See post #3 below. There is a need to upload a file to the web automatically (without browser). Host - Mini File Host v1.2 (if this does matter). Didn't find specific api in documentation, so at first i sniffed browser requests in Firebug as follows : Params : do Value : verify POST /upload.php?do=verify HTTP/1.1 Host: webfile...

Why are LINQ extensions written in a very difficult to read way?

I was checking some of the code that make up LINQ extensions in Reflector, and this is the kind of code I come across: private bool MoveNext() { bool flag; try { switch (this.<>1__state) { case 0: this.<>1__state = -1; this.<set>5__7b = new Set<TSource>(this.compare...

How can I capture the contents of one or more strings using a regex?

Let's say I have the following three strings: (section1){stuff could be any character, i want to grab it all} (section1)(section2){stuff could be any character, i want to grab it all} (section1)(section2)(section3){stuff could be any character, i want to grab it all} So if applied regex to my expressions, for the first I would get: ...

WPF ListBox Width / MaxWidth

I have a databound ListBox with a DataTemplate setup. The DataTemplate contains a Grid control with two column widths of Auto and *. I would like this column to always fill the ListBoxItem and never extend past the LisBox control to make the horizontal scrollbar visible. I am able to bind the MaxWidth to the DataTemplate's grid using:...

The correct way to set up SSL in .NET

I am putting together a retail site and want to know what the 'correct' way to implement an SSL in a .Net project is? I realise that that is a bit open ended but i find the MS documentation on the matter a little confusing. I want the whole site to use SSL, and I have also read that the cookie used must also have certain switches turne...

View Added Items in Visual Studio

I just began using Visual Studio to work on a practice .NET project. I have added a stylesheet that I made outside of VS. I went to Project/Add Existing Item... My question is, how can I view all the items I have added to a project. ...

How can I rate limit an upload using TcpClient?

I'm writing a utility that will be uploading a bunch of files, and would like to provide the option to rate limit uploads. What is the best approach for rate limiting uploads when using the TcpClient class? My first instinct is to call NetworkStream.Write() with a limited number of bytes at a time, sleeping between calls (and skipping a ...

Operator overloading in Generic Methods

This code snippet is from C# in Depth static bool AreReferencesEqual<T>(T first, T second) where T : class { return first == second; } static void Main() { string name = "Jon"; string intro1 = "My name is " + name; string intro2 = "My name is " + name; Console.WriteLin...

creat event source issue

Hello everyone, I am using Windows Server 2003 x64 + VSTS 2008 + .Net 3.5 + C#, the API EventLog.CreateEventSource has two parameters, source and logName. I have two questions, How to call function EventLog.CreateEventSource from PowerShell? What are the meanings of parameter source and logName? How their values are reflected in Wind...

Change desktop wallpaper using code in .NET

How can I change the desktop wallpaper using C# Code? ...

Any hints on getting Sitefinity CMS to work on medium trust?

We have been using Mosso / The Rackspace Cloud until very recently, but they have suddenly switched to a medium trust model for .NET for newly added sites and will be migrating existing server farms to medium trust shortly We can't get our Sitefinity CMS V3.6 SP2 (the latest) to work in this environment. Does anyone have any ideas abou...

Adding nodes to non-default namespace results in duplicate qualifiers

I am rewriting an existing XmlDocument, which contains an element that has a new default namespace defined (see below, the assemblyBinding element) <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <legacyCasPolicy enabled="true" /> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> </assemblyBindin...

markup or RTF? in (ASP).NET with C#

I am developing a site and i would like some simple markup. I would need to keep the users newlines (easy enough replace \n with or use pre), a way to allow links and perhaps bold. Would it be best to use a markup or to use RTF? i was thinking maybe i want special characters like :username: to create a link to a user or maybe :icon-use...

Change DisplayName attribute for a property

I am looking for a way to change the value of the DisplayName attribute of a property at run-time. Is this even possible in Windows Forms? ...

.net Placeholders & StringBuilders

When we build our web apps we construct alot of HTML dynamically and the output them to placeholders at run time. One reason for this is to control our HTML output to optimise it for SEO and now that we have been doing this for a while its become 'the way we do it'. Generally its when we are looping through results. My question is, Is ...

(.net) Intermediate language exe editor?

Hello. I know we have ILdasm, but is there any tool out there that will let me edit .exe or .dll files without having to go through all the rigmarole of having to convert it to IL code, with resources includeded, etc etc, manually edit, then recompile again? ...

What is LiveMesh Object and its connection with Silverlight 3.0

I would like to understand that what is Mesh Object and its conection with silverlight, i am bit aware that it has got some relation with Local storage and then sync with the server data. But i would like to understand it fundamentally so if anyone can provide any link to the article for conceptual understanding or Step by step implemen...

.net producing broken jpegs in IE and FF

This is driving me crazy, so... When resizing image to small thumbnail, resulting image cannot be displayed in full by IE and FF. Opera shows the image correctly, and windows image preview also. This is piece of code doing resizing: final_image = New System.Drawing.Bitmap(92, 110) graphic = System.Drawing.Graphics.FromImage...

FileStream Append Data at the top

I am working on a utility. I want to append data at the top of the file, but it is overwritting not appending. For eg : Consider the file.txt : Something existing here Now I want to append "Something more existing here" before the current line. Is there a way I can do without using 2 FileStreams ? ...

How do I check if my solution has unmanaged code ?

Hi, We have a number of people working on a project. Is there any tool that will scan and check my entire solution if it has any unmanaged code or non-typesafe code ? The objective is to host the entire solution with completely managed code, find the loopholes and fix them to be type-safe and managed code. What are the common loophole...