如何在C#.NET Web应用程序中上传到服务器上的文件的URL?
我目前正在处理一个C#.NET Web应用程序,该应用程序支持用户上传文件上传的文件。我正在使用外部WhatsApp API,需要使用URL访问这些文件。因此,我想知道我应该将什么URL传递到API,以便它可以访问服务器上的文件。
URL会像:base_url/file_path/file_name一样?
另外,我必须在相同的路由配置文件中进行哪些更改(因为目前,默认URL模式是base_url/Controller/Action)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于上述讨论,我可以看到“ docundmessage”是其询问的模型。我有两种处理方法。您可以根据系统设计选择任何。
解决方案: - 在根目录下创建虚拟路径。因此,您的API/网站将在某些域下托管( https://example.com )。因此,您的虚拟目录路径将像( https://example.com/filelelelocation )。因此,您的整个文件路径将在此链接下发布。因此,对于您的文件,路径将为 https://abc.or/filelelocation/file_data
注意: - 为您的安全目的禁用目录访问。没有失败的
参考: - IIS虚拟路径
Based on the above discussion, i can see 'DocumentMessage' is the model where its asking. I have 2 ways to handle. you can pick any based on your system design.
Solution:- Create a Virtual path under your root directory. So your api/ website will be hosted under some domain(https://example.com) . So your Virtual directory path will be something like (https://example.com/fileLocation). So your entire file path will be published under this link. so for your File the path will be https://abc.or/fileLocation/file_Data
Note:- Disable the Directory access for your security purpose. Without fail
Reference:- For IIS Virtual Path
For Azure App service