Hi everybody...

I have struck in a issue which is explained below. Pls resolve it...

I have an download option in my web application(ASP.Net with C#), which brings an dialogbox asking where to save the file. But i want to get the path of the file which is going to give by the user, because i have to start a new process to install the downloaded file by giving the path. I am using the following code to download the file, it works fine but i need to fetch the destination path of the file. Please help me out...

Thanks in advance...
This is my code.......

Response.ClearContent();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
            Response.AddHeader("Content-Length", file.Length.ToString());
            Response.ContentType = filepath;
            Response.TransmitFile(file.FullName);
            Response.Flush();
            Response.End();

Recommended Answers

All 3 Replies

You can't really determine what path they're saving the file to-- that dialog box is something the browser uses exclusively. Why not make the application itself determine what directory it's in, then go from there?

Thanks alc6379,

Sorry i am a very new beginner for c#.net. Can u please help me to shape the code with right path.. Sample code is more preferrable..

For security and other reasons, the browser's download dialog does not give you their local path information. You need to create a custom download dialog for your server's app. that allows the user to directly input the path you want to pass to your new process.

Is it possible for you to launch the new process with a default or blank path and that the process's saveas dialog can handle the details without you needing to actually know the path in your app?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.