It behaves differently in my code. The aspx option is working as expected and codebehind is working ok for images but not for some other stuff in my page.
It's difficult to say what exactly is happening. I use response.redirect or Button1.PostBackUrl to the same Defualt.aspx and url rewriting. The url rewriting is confusing the path of images, css, etc. etc. I also have a lot of UpdatePanels and AJAX ASP.NET
controls which render in different positions after the response.redirect or Button1.PostBackUrl. That's why i use base url to prevent errors and reordering / not finding paths. When i use it in aspx MasterPage it's ok, when i use it in codebehind images seem
ok, but other stuff not.
Also, i tried path like "~/" which is not working, only base url in aspx is working ok.
Another thing - i don't want the base url in aspx because when i try to debug with Visual Studio (ASP.NET Development Server) it throws some strange error messages out of ajax controls and updatepanels. When i use it in IIS7 localhost it's not giving errors.
p.s. sorry for my bad English, i feel very tired at the moment.
Digitborn.co...
Member
684 Points
450 Posts
base URL in page head
Apr 28, 2012 12:25 PM|LINK
Hello,
What is the difference between having base URL in aspx page and codebehind:
public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { Page.Header.Controls.Add(new LiteralControl(@"<base href""http://url/"" />")); } //and: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <base href="http://url/" /> </head>It behaves differently in my code. The aspx option is working as expected and codebehind is working ok for images but not for some other stuff in my page.
XIII
All-Star
182674 Points
23445 Posts
ASPInsiders
Moderator
MVP
Re: base URL in page head
Apr 28, 2012 05:48 PM|LINK
Hi,
is the rendered out html exactly the same? Looks so at first glance but just want to make sure.
Like? And it works if you put the base statement directly in the markup?
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Digitborn.co...
Member
684 Points
450 Posts
Re: base URL in page head
Apr 28, 2012 07:01 PM|LINK
It's difficult to say what exactly is happening. I use response.redirect or Button1.PostBackUrl to the same Defualt.aspx and url rewriting. The url rewriting is confusing the path of images, css, etc. etc. I also have a lot of UpdatePanels and AJAX ASP.NET controls which render in different positions after the response.redirect or Button1.PostBackUrl. That's why i use base url to prevent errors and reordering / not finding paths. When i use it in aspx MasterPage it's ok, when i use it in codebehind images seem ok, but other stuff not.
Also, i tried path like "~/" which is not working, only base url in aspx is working ok.
Another thing - i don't want the base url in aspx because when i try to debug with Visual Studio (ASP.NET Development Server) it throws some strange error messages out of ajax controls and updatepanels. When i use it in IIS7 localhost it's not giving errors.
p.s. sorry for my bad English, i feel very tired at the moment.