开发者

Override ~ behaviour in controls

开发者 https://www.devze.com 2022-12-16 09:56 出处:网络
Quick backstory: I\'m making a \"framed\" version of my site that has a different master page than normal (one suitable for iframing). It\'s accessed by mysite.com/Framed/whatever, instead of mysite.c

Quick backstory: I'm making a "framed" version of my site that has a different master page than normal (one suitable for iframing). It's accessed by mysite.com/Framed/whatever, instead of mysite.com/whatever. This is rewritten in IIS to mysite.com/whatever?framed=true. That works fine.

The issue I'm having is that all the links are relative using a ~ like ~/Server.aspx which works fine in the normal site. I need to override that so instead of producing ../Server.aspx (as it "should") it produces ../Framed/Server.aspx or Server.aspx.

Currently thi开发者_JAVA技巧s means that the page goes back to it's normal view (mystite.com/whatever2) as soon as you click on a link, I want it to continue to stay in mysite.com/Framed/...


Don't you really want "../Server.aspx?framed=true" ? That might be easier to pull off


~ resolves to the root of the application, so you could create a virtual directory beneath your main site for your framed version called "Framed", so "~/" resolves to "/Framed/". Then instead of using a query string switch to select your master page, you can check for the presence of "/Framed/" in the raw request URI.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号