.net

Can a ClickOnce deployed application read files from disk?

Howdy, Can an application delivered via ClickOnce in .Net, read Excel and Access files from the users disk? I know the app is susposed to run in a sandbox, I am curious how partitioned this sandbox is from the rest of the system? Could the file be read from a network share as well as the users hard drive? There is an assumpti...

Get File Icon used by Shell

In .Net (C# or VB: don't care), given a file path string, FileInfo struct, or FileSystemInfo struct for a real existing file, how can I determine the icon(s) used by the shell (explorer) for that file? I'm not currently planning to use this for anything, but I became curious about how to do it when looking at this question and I thought...

Scripting language for embedding into C#/.NET applications?

[The only similar question I can find was answered long ago and contains a reference to mostly IronPython. I want to consider other options as well] We have a complex data analysis application written in C#. The application should provide users with a sophisticated means of customizing their data analysis tasks. Currently, we use a mixt...

.NET create scheduled task on server fails with E_ACCESSDENIED

Hello all, I have an ASP.NET website (in C#) that takes in user data and then attempts to create a windows scheduled task. Of course, this works great on the DEV machine, but fails to run on the server. I'm trying to figure out what permission(s) are required on the ASPNET user (or anonymous web user) to create tasks. The error is: ...

Which to use? Visual Studio Development Server or Local IIS Web server?

I've always wondered about this ... and thankfully, now have a good environment of experts to ask this question. When creating a web application project which web server is the most expedient to use? This is a duplicate question ... http://stackoverflow.com/questions/281667/asp-net-development-server-or-localhost-iis ... my bad! ...

Restarting Windows from within a .NET application

How could I restart or shutdown Windows using the .NET framework? ...

How to stretch in width a WPF user control to its window?

I have a Window with my user control and I would like to make usercontrol width equals window width. How to do that? The user control is a horizontal menu and contains a grid with three columns: <ColumnDefinition Name="LeftSideMenu" Width="433"/> <ColumnDefinition Name="Middle" Width="*"/> <ColumnDefinition Name="RightSideMenu" Width="...

SQL Service Broker and .NET Windows Service - Best practices?

I currently have a database that gets updated from a legacy application. I'd like to utilize a SQL Service Broker queue so that when a record is updated, a message is placed in the queue (using a trigger or something). I would then like to have a long running application (Windows service written in .NET) that is constantly "listening" ...

Embedded (ASP.NET) web server

I am looking for a light-web embeddable web server for .NET. I need it to fake a SOAP web-service for automated testing, so it is a big plus if it supports ASP.NET web-services or another easy way to create SOAP web-services. Extra bonus points for quick startup and shutdown and multiple simultaneous instances on different ports. A Goo...

GetHashCode Guidelines in C#

I read in the Essential C# 3.0 and .NET 3.5 book that: "GetHashCode()’s returns over the life of a particular object should be constant (the same value), even if the object’s data changes. In many cases, you should cache the method return to enforce this." Is this a valid guideline? I have tried a couple built-in types in .NET and the...

Configuration File as Embedded Resource

Does anyone out there have an example of using an embedded Configuration File in either VB.NET or C#? I understand how to embed the configuration file, but what is the best method to access it afterward? Can I treat it as a configuration file, like I can with the external configuration files? Any help is greatly appreciated. ...

How can I select the Next/Previous TreeViewItem in a TreeView?

I have First/Last/Previous/Next buttons that change the selected child node of a TreeViewItem. Setting the First and Last node as selected is not a problem. For example, to select the last child node: TreeViewItem selectedItem = (myTreeView.SelectedItem as TreeViewItem); TreeViewItem ParentItem = (selectedItem.Parent as TreeViewItem); (...

Getting odd error on .net ExecuteNonQuery

I'm working in .NET with SQL server on the backend I have a database that I create a record in using a web control - then I need to update some of the fields. I can trap the sql statement and run it in sql server successfully - however, when I try to run execute non-query I get the following error: Unhandled Execution Error Incorrect...

How can I use Performance Counter in w2k8

Hello Problem: I can add+use performance counters in w2k8 with normal user privileges. If I try to create or access a Process performance counter, i get a message that the counter does not exist. Same thing can be tried out in a powershell, a message appears that the counter does not exist. If I do the same thing as Administrator ac...

InvalidOperationException

Has anyone encountered this error using SQL Server 2005 and Data access application blocks in a failover configuration? "InvalidOperationException Framework Data Provider Error 6" It seems to occur in our server application at irregular intervals and more frequently when SQL Server is in failover config? While doing some research I s...

Prompt user to save when closing app

I'm writing what boils down to a document editor. When the application is closing, I need to prompt the user to save changes. This is easy enough. My question is when is it appropriate to not prompt the user, and instead simply discard unsaved data and close. In the FormClosing event, the CloseReason enum includes: None WindowsShutDow...

Team Foundation Explorer - Check In for the First Time

How do you check in code for the first time in Team Foundation Server? I created a local path, dropped some code in it, now what? Hitting refresh doesn't help. ...

How to obtain the IDbCommand output to the DB? (.NET)

I have a SqlCommand object, and I execute its ExecuteNonQuery method. The query fails, but I can't see how to obtain the query to debug it. Could you help me? Update I am currently using Wireshark (tcpdump) to read the command, but I think that its not the best solution Update The CommandText property only provides the Stored Procedure...

Graphics.DrawRectangle(Pen, RectangleF)

http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawrectangle.aspx FillRectangle, DrawRectangle, FillElipse and DrawEllipse all can take 4 Float (or "Single") parameters: x, y, width, height. DrawRectangle is the only one that will not take a RectangleF, though. I was wondering if anyone knew why this is. It sure seems ...

How does Spring.NET use private setters?

While experimenting with this question on collections in Spring.NET, I discovered that Spring can inject a dependency using a private setter. I have two questions: Is this documented anywhere? Is using private setters recommended? The documentation says: Setter-based DI is realized by calling setter methods on your objects... Gra...