locked
How to download an exe to client machine with required parameters ? RRS feed

  • Question

  • User441205184 posted

    From a button click on  ASP.Net page , an exe is downloaded to client machine using the following code

    FileInfo file1 = new System.IO.FileInfo(someexe);
                    if (file.Exists)
                    {
                        Response.Clear();
                        Response.ClearContent();
                        Response.ClearHeaders();
                        Response.ContentType = "application/octet-stream";
                        Response.AppendHeader("Content-Disposition", "attachment; filename=" + "SomeExe.exe");
                        Response.AppendHeader("Content-Length", file.Length.ToString());
                        Response.WriteFile(file1.FullName);

                        try
                        {
                            Response.Flush();
                            Response.SuppressContent = true;
                            Context.ApplicationInstance.CompleteRequest();
                            Response.End();
                        }

         catch(Exception ex)

                      {

                       LogException(ex)

                      }

          }

    The exe requires further information like the user information and server url for invoking Webservice calls from it.
    How can we send the required information from server to client for the for the downloaded exe to work ,rather than creating as a zip file with a config and exe  ?

    Thursday, April 8, 2021 12:41 PM

Answers

  • User475983607 posted

    Litty

    The exe requires further information like the user information and server url for invoking Webservice calls from it.
    How can we send the required information from server to client for the for the downloaded exe to work ,rather than creating as a zip file with a config and exe  ?

    Other ideas...

    Provide the user with instructions and a command line with parameters they can copy and paste from the web.  

    Update the exe to prompt the user for the missing information.

    Compile the exe on the fly to include the user specific parameters.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 8, 2021 1:08 PM

All replies

  • User475983607 posted

    Litty

    The exe requires further information like the user information and server url for invoking Webservice calls from it.
    How can we send the required information from server to client for the for the downloaded exe to work ,rather than creating as a zip file with a config and exe  ?

    Other ideas...

    Provide the user with instructions and a command line with parameters they can copy and paste from the web.  

    Update the exe to prompt the user for the missing information.

    Compile the exe on the fly to include the user specific parameters.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 8, 2021 1:08 PM
  • User441205184 posted

    Thank you so much for the quick reply

    Friday, April 9, 2021 7:09 AM