简体   繁体   中英

route name same as a folder name

I am wondering if i can have a route like below.

    var newHandler = new CustomRouteHandler("~/folder_name/abc.aspx");
    routes.Add(new Route("folder_name", newHandler));

I have a folder in my asp.net website named "folder_name" and i want a route with same name to be added to route collection and routing it to abc.aspx in the same folder. I am not able to do this, i am getting HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.

Is there any way to have this "folder_name" routing to "~/folder_name/abc.aspx"?

尝试这个

    routes.Add("folder_name", new Route("folder_name", new CustomRouteHandler("~/folder_name/abc.aspx")));

最后我将abc.aspx设置为“folder_name”的默认文档,并且它有效。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM