Viewed 2k times. It automatically opens a download window. Add a comment. Active Oldest Votes. Tom Tom 2, 1 1 gold badge 15 15 silver badges 21 21 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. Arun Kumar Arun Kumar 1 1 gold badge 1 1 silver badge 4 4 bronze badges.
Add a comment. Active Oldest Votes. Sergey Vyacheslavovich Brunov Viper Viper 2, 1 1 gold badge 19 19 silver badges 40 40 bronze badges. I test it, path can be included in filename. Panagiotis Kanavos Panagiotis Kanavos DownloadFile remoteUri,fileName ;. Christoffer Christoffer 2, 15 15 silver badges 21 21 bronze badges.
Funny remark Many people do this me included , avoid MSDN references and go directly to a stackoverflow post. When i try it i am getting file not found exception? Sign up or log in Sign up using Google. It provides a wrapping class with a support of retrieving all known 94 special folders, and some more goodies. For a quick example here, I just pasted a shortened version of the solution, being able to retrieve only the personal special folders, like Downloads:.
While this was just a nasty wall of code, the surface you have to deal with is pretty simple. Here's an example of a console program outputting the path of the Downloads folder.
GetPath with the KnownFolder enum value of the folder which path you want to query. If you don't want to go through all this hazzle, just install my NuGet package I recently created. Here's the project site , and here's the gallery link note that the usage is different and polished, please consult the Usage section on the project site for more information.
You can store the value in app config file or the registry. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Getting Downloads Folder in C? Asked 9 years, 6 months ago. Active 3 years, 1 month ago. Viewed k times. Kiquenet Hunter Mitchell Hunter Mitchell 6, 18 18 gold badges 63 63 silver badges bronze badges. Maybe using Environment. SpecialFolder enum?
GetDirectoryName Environment. GetFolderPath Environment. Combine path, "Downloads" ;? Kiquenet Don't do that, see my answer.
Ask a Question. Download file from server path c asp? Please Sign up or sign in to vote. See more: C. Posted 6-Jan am sameralkhalili. Add a Solution. ZurdoDev 6-Jan am. The simplest code is to create a hyperlink to the file. Suvendu Shekhar Giri 6-Jan am.
Anything you have tried so far? Check RyanDev's suggestion. MapPath myrow["UploadFile"]. Response; res. Clear ; res. WriteFile filePath ; res.
0コメント