Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
360 Points
75 Posts
Jan 21, 2007 12:17 AM|LINK
The trick here is to rewrite the path once again in the page's Init event. You need to store the original path in a Context.Item so you can retrieve it in the page's init event. Like so:
// Global.asax Context.Items["originalUrl"] = originalurl;
// Page's Init event protected override void Page_Init() { if (Context.Items["originalUrl"] != null) { string originalUrl = Context.Items["originalUrl"]; Context.RewritePath(originalUrl); } } What this does, is the page will then load all relevant images, controls etc according to the originally requested path. I just had the same problem and found a blog somewhere describing the above. Hope that helps!
Sean
dkode
Member
360 Points
75 Posts
Re: Images are not displayed when using 'HttpContext.Current.RewritePath()'
Jan 21, 2007 12:17 AM|LINK
The trick here is to rewrite the path once again in the page's Init event. You need to store the original path in a Context.Item so you can retrieve it in the page's init event. Like so:
// Global.asax
Context.Items["originalUrl"] = originalurl;
// Page's Init event
protected override void Page_Init() {
if (Context.Items["originalUrl"] != null) {
string originalUrl = Context.Items["originalUrl"];
Context.RewritePath(originalUrl);
}
}
What this does, is the page will then load all relevant images, controls etc according to the originally requested path.
I just had the same problem and found a blog somewhere describing the above.
Hope that helps!
Sean