Downloaded file should open after sending the information to the server.

dprasad
dprasad used Ask the Experts™
on
When user opens a downloaded file, that file should open when it interacts with the server.File what ever we downloaded from server should not open if the user don't have interaction with the server..

Please suggest me on this and how can i proceed further.

Thanks in advance,
sri
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Full stack Software Engineer
Commented:
You could try ping the server or try use head request or download default page .

ping:
//you could use either ip or hostname
var ip = "127.0.0.0";
var hostname = "hostname.com";

  Ping pinger = new Ping ();

            byte[] buffer = Encoding.ASCII.GetBytes ("test123");
            int timeout = 60;
            PingReply reply = pinger.Send (ip, timeout, buffer);
            if (reply.Status == IPStatus.Success)
            {
//hooray
            }else{
//nope
}

Open in new window



head request:

try{
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
request.Method = "HEAD";
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
WebHeaderCollection headers = response.Headers;
//hooray

}catch(Exception ex){
//nope
}

Open in new window


download default page:
WebClient client = new WebClient ();
        string reply = client.DownloadString ("www.google.com");

Open in new window


based on http://stackoverflow.com/questions/1043342/c-sharp-check-remote-server
Meir RivkinFull stack Software Engineer

Commented:
why grade C?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial