我想在打开之前检查ASPX文件是否存在,因为它是动态加载的。使用以下代码应该很容易:
string directoryPath = Server.MapPath("~/Forms/");
string filePath = directoryPath + nameOfFile + ".aspx";
if (File.Exists(filePath))
{
Response.Redirect("~/Forms/" + nameOfFile + ".aspx");
}
对于IIS中未经aspnet_compiler.exe预编译的网站。但是,如果我预编译它们(甚至是同一个网站),则不再找到这些页面。通过预编译它们,磁盘上仍然存在虚拟文件,因此应该在文件系统上找到它们。
也许有人可以帮我解决这个问题......
答案 0 :(得分:0)
您可能需要更进一步并反映预编译的dll以查看它们是否包含您要加载的页面类