.net - how to read resources file by key?

How do i retrieve a value from a resources file based on the key?I've got a resources file called GlobalStrings.resx:I would like to be able to pass in Sheepsmilk and get back Sheep's milkHow do i retrieve a value from a resources file based on the key?I've attempted like so:Dim milk = My.Resources.GlobalStrings["Sheepsmilk"]however, i'm getting the following exception: 'GlobalStrings' is a class type and cannot be used as an expression....Read more

Novell.Directory.Ldap.NETStandard, .Net Core 2.0 : Issue while getting 'objectGUID' value from Active Directory

I am using .Net Core 2.0 and Novell.Directory.Ldap.NETStandard 2.3.8 and used the following code to get User resource attributes from active directory.I am getting values for all attributes except for objectGUID where I am getting some garbage value.LdapEntry userEntry = ldapConn.Read(dn);LdapAttribute uid = userEntry?.getAttribute("objectGUID");Output:{LdapAttribute: {type='objectGUID', value='�� ���E�1���Ѕv'}}There are no issues if I use LDAP as a backend entity.When I used below code to get Guid, I got following Guid(SupportClass.T...Read more

.net - String or binary data would be truncated. The statement has been terminated error

protected void Page_Load(object sender, EventArgs e) { dbcon = new SqlConnection(ConfigurationManager.ConnectionStrings["modelConnectionString"].ToString()); dbcon.Open(); Session["connection"] = dbcon;}protected void create_account_button_Click(object sender, EventArgs e) { try { String username = username_textbox.Text; String pass = pwd_textbox.Text; String mob = mobile_textbox.Text; String email = email_textbox.Text; String add = address_textbox.Text; String ques = question_drop_down.Text...Read more

.net - Discover or query for service interfaces on service fabric service

I'm implementing a utility to backup services in service fabric applications. The goal is to automate our backup process for SF applications we implement. Services in the application that support backing up with the utility will implement an interface, something like IMyBackupInterface. Enumerating stateful services in the application is pretty easy but I don't see any way to identify which services implement a particular interface. At the moment I am just creating a service proxy for this interface and attempting to call the methods. Services ...Read more

ssl - Can I use TLS 1.2 or 1.1 (if 1.2 is not available) in .net when calling a web servivce?

I would like to be able to use TLS 1.2, if a web service requires it, but also (for the time being) make calls using TLS 1.1 to services that do not support it. Currently we are using ServicePointManager.SecurityProtocol to set this in our code. (.net 4.0) Is this already backwards compatible? Or is it an all or nothing thing? And if so, is there some way to OR things together?...Read more

.net - Logging in from IIS webserver to sql database

I've got a problem that I just cannot get my head around.I've developed a simple application using Visual Studio, just a few HTML pages and some web forms / asp pages that connects to a Ms SQL server, everything within our corporate virtual server environment. The users (Intranet) can access the web server just fine, but the application cannot connect to the database. The error message is telling that the user Domain\servername is not authorized (error SqlException (0x80131904). Which is logical, as there is no such user. There is a AD service ...Read more

.net - AWS: Connecting from virtual machine to SQL database

I've created a virtual machine on AWS, and I've also created a SQL Server Express instance. I now want a .NET app on the virtual machine to talk to the database.I can connect to the instance/database via SSMS on my laptop using the details:Server name: AdministratorPassword: xxxxSo the instance is up & running, and is publically accessible.In my web.config on my .net app, I have the following connection string: <connectionStrings> <add name="DefaultConnection" connectionStri...Read more

.net - How do Hangfire's short polling intervals harm SQL Server?

In Hangfire's documentation, there's a mention of polling interval (when using SQL Server as the storage): You can adjust the polling interval, but, as always, lower intervals can harm your SQL Server, and higher interval produce too much latency, so be careful.What I'm wondering is how exactly do short polling intervals harm SQL Server? What will I see if Hangfire starts polling every 5 seconds instead of the default 15 seconds? Can it significantly affect the performance of non-Hangfire queries?...Read more

.net - WinForms 4K and 1080p scaling / high DPI?

So, here is the scenario: I am trying to make all of my forms (which are Winforms) look good in 4K and 1080p also known as high-DPI or "dpi-aware". I (for the purpose of this question) have three forms: frmCompanyMasterEdit which inherits from frmBaseEdit which inherits from frmBase, which inherits form System.Windows.Forms.Form. I have tried the old way, by making my application DPI-aware in the manifest: <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns=" more

.net - NullReferenceException mystery

For some reason when my application starts up, I get a System.NullReferenceException. Whats really strange, is how the exception box doesn't point to any line of code. I have no idea what part is causing the problem. Here is the stacktrace:System.NullReferenceException was unhandled Message="Object reference not set to an instance of an object." Source="Microsoft.VisualBasic"StackTrace: at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.MainFormLoadingDone(Object sender, EventArgs e) at System.EventHandler.Invoke(Ob...Read more

.net - How do you configure an OpenFileDialog to select folders?

In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I've never really liked that dialog. It starts too small and doesn't let me take advantage of being able to type a path.I'm almost certain by now there's not a way to do this from .NET, but I'm just as curious how you do it from unmanaged code as well. Short of complete...Read more

.net - VB.Net calling win32 api on 32 and 64 bit systems, runs OK on 32 but not 64

To make an existing managed application with unmanaged 'appendages' 64-bit capable, I decided to rewrite a 32 bit unmanaged VC++ dll as a managed VB.Net class library.The application must be able to run on any framework from 2.0 up, and the VC++ code I ported was using named pipes, which are supported only from framework 3.5 up.So I had to resort to reflection, calling windows API functions for everything related to the pipes.The result works perfectly in 32 bit mode, but in 64 bit, I get all kinds of trouble. The actual behavior may change dra...Read more

.net - sendmessage api to select a specific index of combobox control

I am coding an app that can select another app's ComboBox with a certain index.For example, I want to select the second listed item "Adobe flash player" from my app with hooking.The ComboBox app is not mine so I cannot modify the target app.Usually, putting a text or clicking a button can be done by using Sendmessage API in VB.Net.The handle value(hWnd) of that ComboBox can be retrieved.I want to know which function(api) to use and which value should be used.Thank you....Read more

.net - Managed driver for MS Access

MS Access files can be read using JET or the newer ACE. Both of these are native drivers, i.e. they have to be installed. Oracle databases can be queried using native drivers (Oracle Client) or managed .NET drivers (ODP.NET). Is there such a thing as a managed .NET driver for MS Access?...Read more