Created
September 22, 2016 02:42
-
-
Save neo125874/af5a545787163e9ae4f1fab5a7d4b710 to your computer and use it in GitHub Desktop.
PlayOnServer(global.asax.cs)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void Application_Start() | |
{ | |
//check for bin files to be loaded | |
CheckAddBinPath(); | |
} | |
public static void CheckAddBinPath() | |
{ | |
// find path to 'bin' folder | |
var binPath = Path.Combine(new string[] { AppDomain.CurrentDomain.BaseDirectory, "bin" }); | |
// get current search path from environment | |
var path = Environment.GetEnvironmentVariable("PATH") ?? ""; | |
// add 'bin' folder to search path if not already present | |
if (!path.Split(Path.PathSeparator).Contains(binPath, StringComparer.CurrentCultureIgnoreCase)) | |
{ | |
path = string.Join(Path.PathSeparator.ToString(CultureInfo.InvariantCulture), new string[] { path, binPath }); | |
Environment.SetEnvironmentVariable("PATH", path); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment