.net

Is it safe to store an ObjectContext in a thread static variable in ASP.NET?

I've read that I should store an ObjectContext in HttpContext.Current in order to share my ObjectContext across different services/repositories that are called in a request. I'm wondering if it is safe to use an ObjectContext with the [ThreadStatic] attribute on a static class variable instead. Is that a safe thing to do? Is each request...

Implementing dictionary subclass in F#

I'm new to the .Net world and I'm trying to figure out how inheritance and interfaces work exactly. I am trying to implement a Dictionary<string,string> that keeps all the keys as upper case strings. In F# my first naive stab was type UpperDictionary1() = inherit Dictionary<string, string>() override this.Add (key: string, va...

Replace an Image in an existing Multiple Page Tiff using .Net

Using .Net how do I replace the first page of a multiple page tiff file with a new image. Preferable without create a new file. ...

How to do Authentication between a webservice and a mobile phone?

Hi I want to make a windows mobile 6 cellphone application. This application will talk to a web service that I want to make. I don't know must about web services and programming app for phones so I got a couple questions. How do I do authentication? Like my user loads up my app and goes to the login page. They type in there credenti...

Making a single ClickOnce installer for two applications

I am using Visual Studio C# 2008 Express Edition. I have a Solution that has several projects, most of which are class libraries but two of which are executable projects (a GUI and a command-line interface). Is there a good way to make a single ClickOnce installer that installs both of the executable projects? If I make one of the pro...

"Unrecognized configuration section connectionStrings."

I had been working on a project in VS2005 that utilized a local connection to an Access DB. In the past week, I installed .NET framework 3.5 for use w/ a different project as well as VS6. I went back to my VS2005 application and suddenly there are big issues: In the designer for any class utilizing my OLEDB connection showed this: Un...

How can I fill a GraphicsPath with overlapping curves?

Using .NET's System.Drawing.Graphics GDI stuff, I have a shape consting of two arrays of points. They are the red and green pixels in the image below. Now I am trying to fill the interior of this shape with a color. Drawing it as simple lines works just fine. Like this: g.DrawCurve(Pens.Red, points1); g.DrawCurve(Pens.Green, p...

Best way to convert PDF to PowerPoint serverside in .NET

I have a PDF file that I want to convert to PowerPoint using .NET. What is the best tool for the job? The most important part of the conversion is that it looks as similar to the source as possible. Well, that and it can be done programmaticly. ...

How to get "Company" and "Department" from Active Directory given a UserPrincipal object?

Is this possible? Code sample would be nice. Thanks ...

.net request.GetResponse() is giving me a ProtocolViolationException when header last-modified contains string "Fri, 20 Nov 2009 15:53:16 E. Australia Standard Time" ?

Hi, Q1 - Is this a bug in .net, or is the webserver I'm using for testing ( Mongoose ) not server up the header field Last-Modified in the format it should? So in C# VS2008 if I make the call: response = (HttpWebResponse)request.GetResponse(); Console.Out.WriteLine(" - LM = " + response.LastModified); I get: ProtocolViolationExceptio...

Cost of creating Font objects in .NET

Hi, In the application I'm developing , we use the DevExpress XtraGrid control, which has a RowCellStyle event that allows to customize the style of each cell. The event handlers for this event typically look like that : private gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e) { if (/* Some condition */) { ...

Data Binding using DataBinder.GetPropertyValue()

Hi – I have a pretty straight forward data binding question (from the side of writing data bindable controls) that has me confused. Looking at the .NET source code, it seems that most data binding is abstracted via the DataBinder.GetPropertyValue() method. This method takes an object and a property name, and the method will find the va...

.Net CF wait for application to display window before sending key strokes

A change in a vendor's WinMo application forces me to jump through some hoops to avoid forcing my users to log in every time. This is highly inconvenient as A) my users are farmworkers who aren't highly sophisticated and B) the application is not sensitive in the sense that there is any meaningful data associated with running the app on ...

How do I iterate through instances of a class in C#?

Is there a way to iterate over instances of a class in C#? These instances are not tracked or managed in a collection. ...

Best way to resize form/controls according to resolution?

I was an idiot and designed my VB app on a 17inch monitor in a 1280X1024 resolution completely forgetting about what it would like on another machine. This might be a long shot, but is there an easy way to get the resolution of the users monitor and re-size the controls and form accordingly? Thanks in advance. ...

Word by word comparison of two strings

Hello, I need to do Word by word comparison of two strings. Something like diff, but for words, not for lines. Like it is done in wikipedia http://en.wikipedia.org/w/index.php?title=Horapollo&amp;action=historysubmit&amp;diff=21895647&amp;oldid=21893459 In result I want return the two arrays of indexes of words, which are different i...

Focus Lost event for a Winforms TextBox?

Which event should I use for this? ...

splitting a filename - substring ??

I have the following filename: SCO_InsBooking_1.pdf SCO_InsBooking_10.pdf SCO_InsBooking_100.pdf SCO_InsBooking_1000.pdf I an reading the file name using FileInfo and want to split it so I only get the 1, 10, 100 or 1000 number how would I achive this? ...

Entity Framework: Adding a scalar property which is equal to a FK id

Hi guys Short Question: Basically I am trying to add a scalar property to my entity which holds the ID of a FK entity. What I have tried to do thus far: What I have tried so far is adding the scalar property (called ChildId) and mapped it to the matching column in the database. Now as you can imagine I get some exceptions when I tr...

Better Practice: CheckBox DataBindings vs CheckedChanged event

I have a CheckBox that, when checked/unchecked will toggle the Enabled property of some other controls. I did have my code looking something like this: checkBox.CheckedChanged += new EventHandler((o, e) => { control1.Enabled = checkBox.Checked; control2.Enabled = checkBox.Checked; }); But today I started playing with DataBin...