c#
How do I encode and decode a base64 string?
Encode Decode
..The underlying connection was closed: An unexpected error occurred on a receive
The underlying connection was closed: An unexpected error occurred on a receive. This problem occurs when the server or another network device unexpectedly closes an existing Transmission Control Protocol (TCP) connection. This problem may occur when a time-out value on the server or on the network device is set too low. To resolve this problem, … Read more
OnCollisionEnter2D not being executed?
I think its because of kinematic A kinematic Rigidbody2D will only collide with a dynamic Rigidbody2D body type. The exception to this is if Rigidbody2D.useFullKinematicContacts is set to true in which case it will collide with all other Rigidbody2D body types. Try setting Body Type to Dynamic and see if OnCollisionEnter executes. OR Add a dynamic Rigidbody2D to the other collider
Regex for numbers only
Use the beginning and end anchors. Use “^\d+$” if you need to match more than one digit. Note that “\d” will match [0-9] and other digit characters like the Eastern Arabic numerals ٠١٢٣٤٥٦٧٨٩. Use “^[0-9]+$” to restrict matches to just the Arabic numerals 0 – 9. If you need to include any numeric representations other than just digits (like decimal values for starters), then … Read more
How do I create a Shared Code project (.shproj)
Edit: According to the Visual Studio 2015 Preview documentation, VS 2015 adds templates for shared projects and a UI for managing the references, so the below should no longer be necessary after upgrading. There does not seem to be a way to create one directly. It appears currently that Shared Code projects are automatically created when you … Read more
Where can I find the assembly System.Web.Extensions dll?
EDIT: The info below is only applicable to VS2008 and the 3.5 framework. VS2010 has a new registry location. Further details can be found on MSDN: How to Add or Remove References in Visual Studio. ORIGINAL It should be listed in the .NET tab of the Add Reference dialog. Assemblies that appear there have paths in … Read more
Reading settings from app.config or web.config in .NET
You’ll need to add a reference to System.Configuration in your project’s references folder. You should definitely be using the ConfigurationManager over the obsolete ConfigurationSettings.
How can I get the application’s path in a .NET console application?
System.Reflection.Assembly.GetExecutingAssembly().Location1 Combine that with System.IO.Path.GetDirectoryName if all you want is the directory. 1As per Mr.Mindor’s comment:System.Reflection.Assembly.GetExecutingAssembly().Location returns where the executing assembly is currently located, which may or may not be where the assembly is located when not executing. In the case of shadow copying assemblies, you will get a path in a temp directory. System.Reflection.Assembly.GetExecutingAssembly().CodeBase will return the ‘permanent’ path … Read more
The remote server returned an error: (403) Forbidden
Add the following line: This will let the application use the credentials of the logged in user to access the site. If it’s returning 403, clearly it’s expecting authentication. It’s also possible that you (now?) have an authenticating proxy in between you and the remote site. In which case, try: Hope this helps.