I have to do an IIS module that blocks access to users who don't have a certificate from a certain CA. I did a CTL - certificate trust list. I tested it using netsh http add sslcert ip.... and it works. Now all i have to do is implement the call of netsh in the c# class library. I tryed to use:
Process pnet = new Process();
pnet.StartInfo.FileName = "netsh";
pnet.StartInfo.Arguments = "http delete sslcert ipport=0.0.0.0:443";
pnet.StartInfo.UseShellExecute = false;
pnet.StartInfo.CreateNoWindow = true;
pnet.Start();
pnet.Close();
This works in a C# console application, but in the C# library class, doesn't start.
namespace IISproject
{
public class MyModule : IHttpModule
{
#region IHttpModule Members
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.PreRequestHandlerExecute += new EventHandler(OnPreRequestHandlerExecute);
}
#endregion
public void OnPreRequestHandlerExecute(Object source, EventArgs e)
{
HttpApplication app = (HttpApplication)source;
HttpRequest request = app.Context.Request;
if (!String.IsNullOrEmpty(request.Headers["Referer"]))
{
throw new HttpException(403,
"Uh-uh!");
}
Process pnet = new Process();
pnet.StartInfo.FileName = "netsh";
pnet.StartInfo.Arguments = "http delete sslcert ipport=0.0.0.0:443";
pnet.StartInfo.UseShellExecute = false;
pnet.StartInfo.CreateNoWindow = true;
pnet.Start();
pnet.Close();
}
}
What am i doing wrong?10x