asp.net - Using custom virtual paths -
i'm making test solution 2 or 3 pages organized in folders this:
and when run app url this:
there way maintain physical path having different virtual path
http://localhost:40300/index.aspx
without odd word "views"?
take @ url rewrite module iis. alternative, can create custom http module rewrite virtual path appropriately:
public class myrewritehttpmodule : ihttpmodule { // ... public void init(httpapplication app) { app.authenticaterequest += application_authenticaterequest; } private void application_authenticaterequest(object sender, eventargs e) { var app = sender httpapplication; var path = app.request.url.pathandquery; if (!path.startswith("/views/", stringcomparison.ordinalignorecase)) app.context.rewritepath("/views/" + path); } }
Comments
Post a Comment