.net

Is there a built in functionality in Windows.Forms or WPF for shortcut chains (like in VS Ctrl + K, C)

There is standard functionality for shortcuts which are Modifiers + Key, which is quite easy to implement, but is there a way to easely (using standard libraries) implement shortcuts like Ctrl + K, C (Holding Ctrl press K and then C). Something like keyboard gestures, but I haven't found. ...

Catching a specific WebException (550).

Let's say I create and execute a System.Net.FtpWebRequest. I can use catch (WebException ex) {} to catch any web related exception thrown by this request, but what if I have some logic that I only want to execute when the exception is thrown due to (550) file not found. What's the best way to do this? I can copy the exception message ...

How to catch an exception thrown by a filter in .NET's MVC?

One of the filters on an application I'm developing checks to see if a user owns the item they are trying to alter. The action is decorated by the [RequiresOwnership] attribute, and inside the attribute logic, I check to see if the user owns the item, and if they don't, I throw an UnauthorizedAccessException. My question is this: Where ...

ClickOnce deployment for restricted users

From firsthand experience, it appears that ClickOnce only installs for the current user, and there is no option to install for all users. This is a problem because some users within the company need to use ClickOnce applications but do not have permissions to install applications (for security reasons). So far, the only solution we hav...

Who Disposes of an IDisposable public property?

If I have a SomeDisposableObject class which implements IDisposable: class SomeDisposableObject : IDisposable { public void Dispose() { // Do some important disposal work. } } And I have another class called AContainer, which has an instance of SomeDisposableObject as a public property: class AContainer { Som...

Where to get D for .Net

Hi, Where can I get D for the .Net framework? ...

Reusing session identifier

hello A) I assume Asp.Net allows you to reuse session identifier only if we operate in cookieless mode, but not if we use cookies to store session ID? B) From my book: By default, ASP.NET allows you to reuse a session identifier. For example, if you make a request and your query string contains an expired session, ASP.NET creates ...

application domains and threads

A quote from MSDN: http://msdn.microsoft.com/en-us/library/6kac2kdh.aspx One or more managed threads (represented by System.Threading.Thread) can run in one or any number of application domains within the same managed process. Although each application domain is started with a single thread, code in that application d...

how do i impersonate a windows authenticated web user over a .net remoting call?

I have an web application that uses windows integrated security. I also have a windows service that runs as local system. The web application uses .NET remoting to execute a method on the serivce through tcpip channel. Is there a way, on .NET 2.0, to pass the windows identity to the service? ...

Multiple port asynchronous I/O over serialport in C#

I'm trying to write a test application for serial I/O (RS-232) with multiple units in C# and I'm running into an issue with my lack of threading experience so I'm soliciting feedback for a best known method. I've got a pool of COM ports COM1-16 each of which can read/write at any time and I need to be able to manage them simultaneously....

'Rotate' data in a WinForms datagrid

Using Winforms .NET 2.0, my client has requested that data in a Datagrid be displayed vertically rather than horizontally. The data layer of the app is built upon NHibernate, so I generally avoid writing raw SQL in favor of HQL. However, this scenario may lend itself to utilizing the 'crosstab' functionality of SQL Server 2005. So f...

Change the icon for a .net executable post-build?

I have a .NET app that I produce several different versions - the exact same app but with different 'branding' (splash screen, name, etc.). I have all of those differences outside the main executable so they're picked up at runtime, however I can't do this with the program icon because it's baked into the .exe. I'd like to avoid making ...

How can I open a locked mdb file?

I have a database that is locking mdb's and such that I'd like to backup. However the tool (I have the source) I am using opens the file before backing it up and finds that it is locked. Is there a way I can open it for read-only purposes? For reference the tool uses C# and .NET 2.0 (but can be updated to 3.5). ...

data binding update when value changes, not when tabbing out

Is there a property or setting to force a bound control in Winforms to update the object it is bound to when the input value, either in a textbox or whatever, actually changes? And not after the control is tabbed out of. ...

Difference between Monitor.Pulse and Monitor.PulseAll

Monitor.PulseAll notifies all waiting threads in the queue. Monitor.Pulse notifies a thread in the waiting queue. (The next waiting thread) Only the next Thread (1 Thread) can acquire the lock. So what is the difference? When should i use Pulse and when PulseAll? ...

Relative links automatically gain the session ID

Hello, Because the session ID is inserted in the current URL, relative links also automatically gain the session ID. In other words, if the user is currently stationed on Page1.aspx and clicks a relative link to Page2.aspx, the relative link includes the current session ID as part of the URL. The only real limitation of cookieless ...

Entity Framework: Is there a way to check if the context has an object?

Situation: Object in session from a past context can't be set as another object's parent since other object is in a new context. Say I have a User in session that I had retrieved from a context. Now the page reloads, that context has been dismissed, and a new context is made. someUser = context.First(user => user.id == id); Session["...

Using WPF, can I (easily) implement a panel control that allows me to display a single element multiple times.

Interface functionality isn't important (right now) with the children, but it would be handy if there were some way to say that the child can be both "here" and "there" and that it should be treated as a single object. I am implementing a repeating, scrolling viewer that treats its canvas as a repeating plane, and I would like to be abl...

What does "The .NET framework uses the UTF-16 encoding standard by default" mean?

My study guide (for 70-536 exam) says this twice in the text and encoding chapter, which is right after the IO chapter. All the examples so far are to do with simple file access using FileStream and StreamWriter. It aslo says stuff like "If you don't know what encoding to use when you create a file, don't specify one and .NET will use ...

How to pass data to an ITaskItem property of an MSBuild task?

Hi folks, i have a custom Task which i use in MSBuild. Works great. Previously, i had some properties which accepted some string data. It was suggested I should change them to ITaskItem's. This way, if i have spaces, i shouldn't have a problem. Previous code public class CompressorTask : Task { .... public string CssFile...