How to convert a string to a stream, without using encoding in C#

0 Comments

If you want to convert a string to a stream, without using encoding. You can use the following string extension:   usage namespace PTB.Cs.Test.Research { using PTB.Cs.Extensions; using System; using System.IO; using Xunit; public class

How to get the absolute root folder path of a ASP .NET website / MVC website.

0 Comments

  The following code result in my case to rootFolderPath = "C:\inetpub\wwwroot\MvcApplication1". Uri uri = new System.Uri(Assembly.GetAssembly(typeof(MvcApplication)).CodeBase); string binFolderPath = Path.GetDirectoryName(uri.LocalPath); string rootFolderPath = new DirectoryInfo(binFolderPath).Parent.FullName;

Combine base URL string with a relative path string in C#

0 Comments

One way of combining a base URL string with a relative path string in C#:   [TestMethod] public void Combine_base_url_with_relative_path_test() { Char slash = '/'; // Make sure sharePointUrl does not end with a slash.

POST multiple parameters to an ASP .NET Web Api REST service from a .NET 3.5 assembly, by using one dynamic JObject "options" parameter.

0 Comments

  Client code in .NET 3.5   namespace WordMerge.EndToEndTests { using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; using Newtonsoft.Json; [TestClass] public class UnitTest1 { [TestMethod] public void Execute_a_post_request() { string url = "http://localhost:63544/api/document"; object result =