ASP.NET - 将图像 URL 重定向到新文件夹
我的公司正在弃用我们的 Web 表单项目并仅使用 MVC 3。MVC 3 中图像的默认文件夹是 ~/Content/images/.. 问题是我们的 WebForms 指向 ~/images/..
我们的客户可以直接链接到 https://www.myurl.com/images/imagename.png 我们希望它自动返回 https://www.myurl.com/content/images/imagename.png 代替。
处理这个问题的最佳途径是什么?
My company is in the process of deprecating our Web Forms projects and using just MVC 3. The default folder for images in MVC 3 is ~/Content/images/.. The problem is that our WebForms was pointing to ~/images/..
We have clients who have direct links to https://www.myurl.com/images/imagename.png and we want it to automatically return the image at https://www.myurl.com/content/images/imagename.png instead.
What is the best route to handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以创建一个 ImageController 控制器,如下所示:
然后您可以设置路由,以便 URL
/images/
转到ImageController::Index
。You could create an ImageController controller, something like this:
Then you'd set up your routing so that the URL
/images/
goes toImageController::Index
.我认为您需要创建 HTTP 处理程序并自动重定向到其他文件夹
请参阅此链接
http://www.nerdymusings.com/LPMArticle.asp?ID=12
http://support.microsoft.com/kb/308001
I think you need to create HTTP handler and automaticaly redirect to other folder
See this link
http://www.nerdymusings.com/LPMArticle.asp?ID=12
http://support.microsoft.com/kb/308001