Monday, March 26, 2012

Please Help - DNS DIG

Hello,
this is a bit of a strange one and i don't know if anyone will know this. i want to be able to do DNS digs from my website. i want it to have the same functionality a dig or nslookup command line application. can anyone tell me how to implement this in an asp.net application or anywhere i can download callable dlls.
Thanks again for your help
thanks
g
I am not 100% sure, but I don't believe this functionality is inherent in ASP.Net anywhere - you'll need to do it with 3rd party components - - I believe nSoftware.com has one in its IPWorks package - I don't know of any free ones, however.
You will need access to nslookup - but you can just use the exe on the server:

protectedvoid Page_Load(object sender,EventArgs e)

{

System.Diagnostics.ProcessStartInfo psi =new System.Diagnostics.ProcessStartInfo();

psi.FileName ="nslookup.exe";

psi.Arguments ="server";//your nsserver to pass

psi.CreateNoWindow =true ;//Optional

psi.WorkingDirectory = Server.MapPath(".") ;//Execute in the local Vroot

psi.UseShellExecute =false;

psi.RedirectStandardOutput =true;

//Start the process

System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi);

while (p.StandardOutput.Peek() > 0)

{

Response.Write(p.StandardOutput.ReadLine() +"<br>");

}

}

0 comments:

Post a Comment