.net-2.0

Event Log SecurityException for Web Application?

☆樱花仙子☆ 提交于 2019-12-08 06:52:39
问题 I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an admin: "System.Security.SecurityException : Requested registry access is not allowed." message. How can I fix that? Update I have create the registry with the Admin account manually in the registry. Now, I have the error

Method chaining generic list extensions

主宰稳场 提交于 2019-12-08 06:27:45
问题 I have a List of a "complex" type - an object with a few string properties. The List itself is a property of another object and contains objects of a variety of types, as shown in this abbreviated class structure: Customer { public List<Characteristic> Characteristics; . . . } Characteristic { public string CharacteristicType; public string CharacteristicValue; } I'd like to be able to collect a List of the values of a given type of Characteristics for the current Customer, which I can do in

DevExpress dateedit customization to allow only specific dates

自古美人都是妖i 提交于 2019-12-08 05:22:51
问题 I have used the example here How to create a DateEdit descendant that will allow date unit selection, and multiple dates and periods selection. I wanted to add one more functionality where I would provide an array of dates only those will be visible. I have modified the code and included a property to accept the date ranges, which if provided would only allow seeing and selecting those dates, but I'm unable to understand which function I should override to accomplish the task. The behavior

C# removing comments from a string

≡放荡痞女 提交于 2019-12-08 05:17:06
问题 I'm using WinForms NET 2.0. I am coding a small function to trim comments from some selected text. What it does is split the selected text by separate lines, and then: If the line contains no comments, it is appended. If the line contains some text followed by comments, it is appended with comments trimmed. If the line starts with a comment, it does not get appended. This is in the if statement. If the line is blank, it does not get appended. This is also in the if statement. Here is my code:

Amazon EC2 multiple servers share session state

ぃ、小莉子 提交于 2019-12-08 05:13:53
问题 I have a bunch of EC2 servers that are load balanced. Some of the servers are not sharing session, and users keep getting logged in and out. How can I make all the server share the one session, possibly even using a partitionresolver solution public class PartitionResolver : System.Web.IPartitionResolver { private String[] partitions; public void Initialize() { // create the partition connection string table // web1, web2 partitions = new String[] { "192.168.1.1" }; } public String

Can you create sub-applications within applications in IIS/ASP.Net

自作多情 提交于 2019-12-08 03:59:48
问题 We have a global application (well out of my control) that runs a lot of sites. I'd like to create a new application (as I cant extend etc) within a folder so it could be accessed as follows. http://www.domain.com/ < Global App http://www.domain.com/newapp < New App Is this actually possible or just a pipe dream; I'm aware that its possible to set additional locations for assemblies (as per: http://msdn.microsoft.com/en-us/library/4191fzwb(VS.80).aspx) but a full app I'm not to sure. Ta 回答1:

How to make a search usercontrol generic in .net2.0 winforms

萝らか妹 提交于 2019-12-08 03:57:25
问题 I have a search usercontrol that I'd like to make generic. The control itself will contain a different collection of controls dependent on its context. For example it could be stock items, people, address as the context of the search.. How can I make it generic enough that based upon the search context it knows exactly what user controls it needs on the form? Any programmer can then just drag the user control onto their form, set it's context and we are good to go. My first thought is to

DataGridView Binding

烂漫一生 提交于 2019-12-08 01:59:14
问题 I have a gridview that I am binding to via a generic list. I have set all the columns myself. I am just trying to: Catch the event PRE format error when a row is edited- get the row information via a hidden field - and persist I am sure this must be pretty easy but I haven't done much with forms work and I am unfamiliar with its DataGridViews Events. 回答1: There are two ways of looking at this; handle the CellParsing event and parse the value use a custom TypeConverter on the property I

How big is the risk when testing a .net 3.5 Assembly using a .net 4.0 test assembly

南楼画角 提交于 2019-12-08 01:54:30
问题 I realise that Visual Studio 2010 sp1 allows test projects to target 3.5 now. However, for various reasons I don't fully appreciate, our test projects still target dot net 4.0. The general question is in the title. How big is the risk? Specifically, this presumably means that the tests will run in the CLR v4, whereas many of our clients will be using CLR v2. Also, the tests seem to use v4 of library components (such as System.Data), even though the application is built against v2. One method

Equivalent Task in .NET 2.0 [duplicate]

落爺英雄遲暮 提交于 2019-12-07 21:54:40
问题 This question already has an answer here : Is it possible to use the Task Parallel Library (TPL) in C# 2.0? (1 answer) Closed 4 years ago . I know .NET 2.0 it's probably really old now. But I have the code that I want to compile under .NET 2.0. Unfortunately, the source uses .NET 4.0 System.Threading.Tasks Here the code: int count = GetCount(); Task[] tasks = new Task[count]; for (int p = 0; p < count; p++) { int current = p; tasks[p] = Task.Run(() => { // Do something here }); } Task.WaitAll