问题描述
我有一个URL mysite.com/mypage.aspx一个网页,我想如果他们去mysite.com/mypage游客被重定向到这个页面。这只是这一页,我不知道这是否可能在web.config中实现。我没有访问任何来源$ C $ C,只web.config文件(通过FTP)。我试图登录到我们的网站主机的控制面板,以检查是否有任何设置,我可以使用,但它似乎是下来的时候。
I have a page with URL mysite.com/mypage.aspx and I want visitors to be redirected to this page if they go to mysite.com/mypage. It is only for this page and I wonder if this is possible to achieve in web.config. I do not have access to any source code, only to web.config (via FTP). I tried to log in to our web hosts control panel to check if there's any settings there I can use but it seems to be down for the moment.
所以我可以做在web.config中这样的事情(这是ASP.NET 2.0,如果该事项)?
So can I do something like this in web.config (it's ASP.NET 2.0 if that matters)?
先谢谢了。
编辑:我试过
<urlMappings enabled="true">
<add url="~/index.htm" mappedUrl="~/default.aspx"/>
<add url="~/mypage" mappedUrl="~/mypage.aspx"/>
</urlMappings>
它为index.htm的而不是(显然)时,有摆在首位没有扩展名。
It works for index.htm but not (obviously) when there's no extension in the first place.
推荐答案
要尽我所知,你不能这样做在code的任何URL路由与asp.net 2.0(只有3.5,4.0和您需要来源$ C $ C那些)。
To the best of my knowledge, you can't do any url routing in code with asp.net 2.0 (only 3.5, 4.0 and you need source code for those).
你有访问IIS以
这篇关于扩展名的URL重写在web.config中ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!