Sunday, July 26, 2020

Buggish: Amazon WorkSpaces Locked Shift Key (Unresolved / workaround) Update: Resolved? [2020-07]

Replicate: Unknown
Frequency: Multiple times a day, but can get half a day without it occurring
Environments: Two different machines running different versions of AWS Client. Issue seems to be similar even though different OS and different clients.

Workaround: Turn on caps lock, then turn off caps lock. Repeat if necessary. Toggling may not work if toggle too quickly. At most 3 times, but works every time.

Behavior: Basically, the shift key locks on AWS because all actions appear to be as if the shift key is down. Like highlight text between two different mouse-clicks in a text box, select multiple rows in spreadsheet, etc.

Shift is not locked on my machine. This only occurs in AWS. Pressing the shift key does not appear to do anything which kind of makes sense because it should act as if shift key is down. But release shift key does not return the state back. I found toggling caps lock will return the shift key state.

I do not use caps lock at all, so this is not caused by using caps lock. I figured this out randomly.

I cannot guarantee that this does not happen when not using the shift key as I use the shift key very often. I do also use both shift keys (not at the same time). It does seem to occur more often when I am coding C# which uses a lot of shift keys for curly braces and for sql because I cap the keywords. I want to say that it seemed like this issue still occurred once or twice when there was no shift key used, but this seems to be a very rare occurrence.

It may be possible that there is a delayed or lag response to a shift key press which would explain why it occurs more often when I am coding. Oddly, I can also go a few hours without this occurring. This could just be my mind playing tricks, but also seem to occur less often when I work off peak-hours.

There also seems to be quite a few posts dating back to 2016 with no solution so I am not expecting this to be ever resolved, so beware if you decide to use AWS.

Update 2020-09-03

Interesting, not long after this post... this problem has gone away. I cannot recall when this stopped but feels like at least a couple weeks. Has this problem been resolved? Seems like it.

Update 2022

As of 2021, we have moved from AWS to Azure so there will be no more updates on AWS.

Friday, July 24, 2020

Code: C# Accessing network folder with Username and password to system not on the domain

Summary:
I was given a web server that is on a domain but need to back up files to another server (file server) that is not on the domain and with different credentials than the one I am logged on with (or the user assigned to the web server). I was given the credentials to use on the file server. The credential is also not on the domain. The assigned user for IIS was also a local user (ie not a domain user).

The code below was very simple to implement. I tried a few other solutions before finding this one. Others required knowing the domain. The key part for me was the CredentialCache and providing parameter for the machine I am trying to access.


Sample code from social.msdn.microsoft.com:
NetworkCredential theNetworkCredential = new NetworkCredential(username, password, domain);
CredentialCache theNetcache = new CredentialCache();
theNetCache.Add(@"\\computer", theNetworkCredential, "Basic", theNetworkCredential);
//then do whatever, such as getting a list of folders:
string[] theFolders = System.IO.Directory.GetDirectories("@\\computer\share");