Now, this is not exactly the best place for a C#-related question, so I can't exactly tell whether this works for you in your environment but one approach can be to specify the username and password together with the URL like so:
var completeURL = "http://maguser676:mypassword@localhost:1234/magmi/web/magmi_run.php?mode=update&profile=MyMAGMIProfile&engine=magmi_productimportengine:Magmi_ProductImportEngine&CSV:filename=../../data/upload/muk_000000045_price.csv";
Second option would be to comment a part of the authentication behavior and restrict the access to MAGMI by an IP address without further authentication (obviously, you should not do this if the C#-application is executed by a machine without a static IP address and/or there are other reasons why the IP address is not to be rated secure e.g. due to the networks topology it is assigned to):
magmi/.htaccess (create this new file)
# Allow access to MAGMI GUI by the following IP address only
<RequireAll>
Require ip 123.234.123.234
</RequireAll>
magmi/web/security.php (comment the if/else condition)
Note: There may be several places from where you could prevent MAGMI from asking for authentication, but that one was the first that came in my mind:
<?php
require_once(dirname(dirname(__FILE__))."/inc/magmi_auth.php");
function authenticate($username="",$password=""){
$auth = new Magmi_Auth($username,$password);
return $auth->authenticate();
}
// WWW-Auth disabled since we authenticate based on the IP address only.
/*if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate:Basic realm="Magmi"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must be logged in to use Magmi';
die();
} else {
if (!authenticate($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])){
header('WWW-Authenticate: Basic realm="Magmi"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must be logged in to use Magmi';
die();
}
}*/
Ultimately, as a third option you could execute MAGMI by a cron job on the webserver (or by creating a Magento module that will schedule the execution of MAGMI on a regular basis) and just push the CSV to the import directory (side node: MAGMI could even connect to a remote database server e.g. via ODBC to get its data). This however might depend on your actual requirement and would require rather fundamental questions such as why there is a C#-application needed to execute a MAGMI import profile (which for sure can have its very own valid reason).