Think of the security implications of allowing a web page to execute a command to open a specified file on a user's hard drive. This is why you're having issues trying to get that to work, had this been a feature that Microsoft included malicious web sites would be even more rampant that they already are. Why are you trying to allow the user to click a link and have the link download the file and open it at the same time?
There comes a time in software development that developers try to make things too user friendly and try to take all thinking away from their end users. When that happens developers overcomplicate the program and the result is that end users don't like the application because it crashes, has bugs, and/or attempts to out think them (making them feel stupid). On Mar 16, 4:42 pm, OPar <[email protected]> wrote: > I am trying to figure out a way to download a file onto the users > computer from an ASP.NET webpage and then open that file > automatically. > > I'm using the code shown below to download the file. This also give > the option to open the file, but it opens it in the browser -- not the > user's hard drive. > > How can I open the file that was download to the user's hard drive? > > Response.ContentType = "application/vnd.ms-excel" > Response.ContentType = "application/x-msdownload" > Response.AddHeader("Content-Length", fileInfo.Length.ToString) > Response.WriteFile(filePath) > Response.End()
