.net-3.5

Is there a way to complete the post back after writing out a file to the Response?

删除回忆录丶 提交于 2019-12-22 10:54:56
问题 I have a button that when clicked, will generate a PDF and write it out to the response. This is the basic structure of the code: try { using(Stream stream = generatePdf()) { var file = createFile(stream); file.Transmit(HttpContext.Current.Response); } } catch (Exception ex) { // Handle exception // Display Error Message } The transmit method contains the following code: response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", filename)); response.AddHeader("Content

Process.Kill() issue

[亡魂溺海] 提交于 2019-12-22 10:35:22
问题 I have the following lines of code: Process aProcess = Process.Start("ieexplorer", aDummyHTMLFilePath); //I do nothing in between aProcess.Kill(); This runs smooth if there are NO other IE windows open. But if there is a window open, I get a System.InvalidOperationException on aProcess.Kill(); saying : Cannot process request because the process has exited. Also, I notice that in this case, aProcess.HasExited is true right after line 1 in the code above. How can I smoothly close IE, even if

Add some meta data associated to a particular field when I am assigning a value to the field of a class?

巧了我就是萌 提交于 2019-12-22 10:13:01
问题 I have a class, and I am doing some nifty things with reflection. Now I have a need to add some meta data associated to a particular field when I am assigning a value to the field of a class using reflection (I don't know what the class will be). I would like to do this without the clients to my implementation knowing (having to do anything special of their own). Having a designated "meta" field or object within the class would work, but doesn't feel very elegant since it requires the child

How can I get a count of “Available” processors for my application?

六月ゝ 毕业季﹏ 提交于 2019-12-22 09:33:54
问题 I know how to get the number of physical, and number of logical processors on my machine, but I want to know how many logical processors my application has access to. For instance, I develop on a quad core machine, but I have a number of single core users out there, and in many instances I "dumb down" the interface, or run into locking problems that a multi-core system never experiences. So, to that end I have set up VSTS to build my app in either debug or "Debug Single Core". The goal there

Getting “This method or property cannot be called on Null values” error

时光总嘲笑我的痴心妄想 提交于 2019-12-22 09:00:14
问题 UPDATE 1: The exception is being thrown on this line: client_group_details.Add(new ClientGroupDetails( ORIGINAL QUESTION: I have the following code which I have stripped down from 30 columns of data from the database to just 2 columns from the database. I get an error whenever any of the columns return a NULL value: public class ClientGroupDetails { public String Col2; public String Col3; public ClientGroupDetails(String m_Col2, String m_Col3) { Col2 = m_Col2; Col3 = m_Col3; } public

Find a file in the parent folders with msbuild

给你一囗甜甜゛ 提交于 2019-12-22 08:47:51
问题 In MsBuild it is possible to create a build.proj.user file which is parsed by the Microsoft.Common.Targets build file. I want to have a similar system in place where it is possible to have a .user file in the root of the folder and make msbuild pick up the config settings from this file. Take for example these paths: c:\working\build.proj.user c:\working\solution1\build.proj.user c:\working\solution1\project1\ c:\working\solution1\project2\ c:\working\solution1\project3\build.proj.user c:

C++/CLI use of Action<…,…> and Func<…> unsupported?

蹲街弑〆低调 提交于 2019-12-22 08:46:08
问题 it does not look like there is support for the Action and Func delegates in the System namespace in C++/CLI. At least not for multiple generic arguments such as: System::Action<int, int>^ action = nullptr; System::Func<int, int>^ func = nullptr; Both result in errors such as: error C2977: 'System::Action' : too many generic arguments error C2955: 'System::Action' : use of class generic requires generic argument list Only single argument Action works: System::Action<int>^ action = nullptr;

How will .NET 3.5 SP1 impact my .NET 1.1 applications?

夙愿已清 提交于 2019-12-22 08:38:05
问题 If I have a number of existing applications written and deployed w/ .NET 1.1, is there any risk to installing .NET 3.5 SP1 on the servers? My understanding is that .NET 3.5 SP1 only works with the .NET 2.0 codebase, so it will not touch or affect my .NET 1.1 applications. Can you also point me to any pertinent MSDN documentation? I've searched but can't find anything. Thanks! 回答1: I have .NET 3.5 SP1 installed on a server with some existing .NET 1.1 applications and haven't noticed any

Databinding a combobox column to a datagridview per row (not the entire column)

亡梦爱人 提交于 2019-12-22 08:29:19
问题 There are a few posts about this, but after hours of searching I still can't find what I need. The answer in the following post almost gets me what I want: Combobox for Foreign Key in DataGridView Question 1: Going off that example where a Product has many Licenses, my database mappings are all many-to-one relationships which means my License class holds a reference to the Product class. The License class does not have a property for the ProductId since that can be retrieved via the Product

Context menu is cut in some situations in WPF

我与影子孤独终老i 提交于 2019-12-22 08:12:04
问题 Context menu is truncated in different .NET Framework. See images inside ZIP file (there are two screenshots, one from XP and other from Win7). I created a simple Visual Studio 2010 solution which repro my issue. ( http://www.mediafire.com/download.php?doq7gsh75qgvzwq ). On XP it seems to work fine, but not on Windows 7. The issue can be reproduced on Windows 7 if target .NET Framework is 3.5 (including SP1) (please see the image from zip). If I change the target framework to 4.0 it works