网站首页是 index.aspx,经过url rewrite后,输入index.html即可访问。但是当输入网站的地址时,如 http://www.netcourse.com/,后面一般是不显示文件名index.html的,这样提交表单,比如查询时,就会出现"无法显示网页,由于网页地址不正确,正在查找的网页无法显示。"的错误,而如果输入全部的文件地址,http://www.netcourse.com/index.html,则一切正常,应该如何处理这个问题呢?一般网站都有默认首页的,比如访问新浪,输入http://www.sina.com.cn,其实访问的是http://www.sina.com.cn/index.shtml,怎么办呢?
解决方案 »
- AspNetPager分页问题
- javascript window.location拼接两个参数跳转页面
- 论友进来看下!!!!!!!!!
- 救命!!网页打开时候,点击删除按钮,提交后没删除?貌似页面关闭,重新再开就被删除了????
- url 映射
- 怎样才能成为高手...先辈指点一二 看好了..100分
- javascript验证文本框的输入只能是数字或者汉字
- 各位大虾,请推荐带源代码的商业网站的例子,用vs 2005 做的有吗?供初学者学习学习,不胜感激!
- 如何为"浏览"(File Field)控件指定目录?
- 急!生成webconfig出错
- System.Web.UI.WebControls包含的前缀数目
- 关于CSS的,达人进,....
由于你是把INDEX.ASP映射上去的,并不存在这个文件 所以会报找不到文件
你可以在首页所在目录下添加一个名为index.html的空文件,这样就解决了默认文件不存在的问题这个在URL REWRITER的文档里都写了...明显没有仔细读文档
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.UI;
namespace ActionlessForm
{
/// <summary>
/// The Form class extends the HtmlForm HTML control by overriding its RenderAttributes()
/// method and NOT emitting an action attribute.
/// </summary>
public class Form : System.Web.UI.HtmlControls.HtmlForm
{
/// <summary>
/// The RenderAttributes method adds the attributes to the rendered <form> tag.
/// We override this method so that the action attribute is not emitted.
/// </summary>
protected override void RenderAttributes(HtmlTextWriter writer)
{
// write the form's name
writer.WriteAttribute("name", this.Name);
base.Attributes.Remove("name"); // write the form's method
writer.WriteAttribute("method", this.Method);
base.Attributes.Remove("method"); // remove the action attribute
base.Attributes.Remove("action"); // finally write all other attributes
this.Attributes.Render(writer); if (base.ID != null)
writer.WriteAttribute("id", base.ClientID);
} }
}
使用:<%@ Register TagPrefix="ZDIL1" Namespace="ActionlessForm" Assembly="ActionlessForm"%><ZDIL1:FORM id="Form1" runat="server" method="post">........</ZDIL1:FORM>ok了。
<form action="?xx=x1"........
如果有把action="....改成你真实的提交页面具体地址。
<skm:Form method="post" runat="server" id="F1" onsubmit=go()>function go(){
//alert("ok");
document.F1.action="index.html";
document.F1.submit();
}即可,看来,某些问题上,求人不如求己啊!!!还是谢谢大家的帮助