.net-4.0

Changing default culture for windows service running as LocalSystem

…衆ロ難τιáo~ 提交于 2019-12-12 22:41:33
问题 Our admins unexpectedly migrated a server where my .NET windows service runs (to Windows 2008 ... because of some old apps). It is running under LocalSystem account. The target framework is .NET framework 4 Client Profile. In my service the method DateTime.Parse now throws invalid format exception. When I add to OnStart Thread.CurrentThread.CurrentCulture = new CultureInfo("cs-CZ", false); it gets better, but still in some methods it fails, probably running in different therads. How to

How can I change the System.Globalization.CultureInfo.CurrentUICulture in my .NET 4.0 web application?

橙三吉。 提交于 2019-12-12 21:17:27
问题 It seems that I have problem changing System.Globalization.CultureInfo.CurrentUICulture value according to the user preferences (.NET 4.0 web application). In my web application, I have two buttons. One for the Greek Language and one for the English language. When the buttons are clicked, a request goes to the server asking to change the user preferred language. For Greek, I send "el-GR" and for English, I send "en-US". On the server side, I use the following piece of code to change the

Change Password Issue in AspNet MembershipProvider

别说谁变了你拦得住时间么 提交于 2019-12-12 21:14:48
问题 I am using AspNet Membership Provider in MVC 3. I am facing issue in change password. I have two functionality in my project Forgot password : ask security question and based on security answer change password. Admin change password: a admin can change password of any user without knowing old password or security answer. Now the issue is that for functionality # 1, i have to make changes in web config for making requiresQuestionAndAnswer="true" for change password so that i can change

Is using DirectoryServices.NativeObject slow/bad?

吃可爱长大的小学妹 提交于 2019-12-12 21:13:47
问题 In an ASP.NET 4 application, I have existing code to access a user's Active Directory information (potentially under Windows Authentication or FBA) like this: // authType taken from run-time config file, default below AuthenticationTypes authType = AuthenticationTypes.Secure; string path = "LDAP://" + domain; DirectoryEntry entry = new DirectoryEntry(path); entry.AuthenticationType = authType; // Bind to the native AdsObject to force authentication. Object obj = entry.NativeObject;

setting up filesystem permissions

房东的猫 提交于 2019-12-12 20:15:48
问题 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Security.AccessControl; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string Directoryd = "D:"; string mydirectory = Directoryd + "\\" + "rs\\"; if (!Directory

Display only an Image with Transparency in a Windows Form?

梦想的初衷 提交于 2019-12-12 19:26:34
问题 I'm trying to get a form in my Windows Forms program to be borderless, invisible, and have a PictureBox control in it. The PictureBox image is set to a PNG with an alpha channel to give it a transparent background. What I want is for the form to be completely invisible but I want the PNG with correct transparency to be visible still. This is only going to be for Windows 7 with Aero theme on so any shortcuts Areo can afford me I can use. I tried using a transparency key for the form like so:

Can't debug ASP.NET application stored in IIS

China☆狼群 提交于 2019-12-12 18:19:06
问题 I have a question regarding IIS (version 7.5) and ASP.NET (.NET Framework 4) . I am trying to debug ASP.NET web application which is stored on IIS. Now, I have done this in past and everytime it worked perfectly. But now when I try to do same, **Visual Studio 2010** always gives me error, **"unable to start debugging on the web server. the iis worker process for the launched URL is not currently running" ...** even the application I had created in past (& stored in IIS) can't debug using

Can I control when DataGridView reads and writes from/to its DataSource?

旧街凉风 提交于 2019-12-12 18:06:41
问题 I'm binding to a List<MyCustomType> and when I put a breakpoint on property getters in MyCustomType , they are seemingly being called repeatedly. What causes the DataGridView to automatically re-read the data and can I control this? Secondly, I note that when I make changes to the data in the grid, these are not immediately replicated to the DataSource. Putting breakpoints on property setters in MyCustomType , they only seem to be called when I click outside the grid control. How can I make

.net 4 backward compatibility

本小妞迷上赌 提交于 2019-12-12 17:25:10
问题 Will a windows application developed in .net 4 which references an assembly developed in .net 3.5, require both .net 4 and .net 3.5 to be installed for the application to run? I suspect so, as is one of my observation. Also, it feels logical as both require different runtime for their execution. [EDIT] I'm enlightened :) So, here's my real question which has remained unanswered for a while here at SO. Would be glad if you guys can figure out the issue! The application's app.config already has

How do I do a “like” wildcard comparison in Entity Framework in .NET 4.0?

一个人想着一个人 提交于 2019-12-12 16:26:45
问题 I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to figure out how to do a wildcard comparison with Entity Framework. I'd like to have the following query for EF where I find all the names that start with 'J' select * from Users where FirstName like 'J%' 回答1: from user in Users where user.FirstName.StartsWith("J") select user; 回答2: Use: var query = Users.Where(user => user.FirstName.StartsWith("J")); 回答3: I would refer you to this question, I assume it hasn't changed in .net 4