Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Are the following lines comments or exectuable code in an ASP.NET file?

 

<!-- #include file='~/imageswap.html' -->
<!--<asp:HyperLink ID="HyperLink10" runat="server" NavigateUrl="~/About/BrucesBrew.aspx"><asp:Image ID="WhatsBrewingPhoto" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingPhoto01.jpg" BorderWidth="0" /></asp:HyperLink> -->
<%--<asp:Image ID="WhatsBrewingLS" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingLeftSpacer.gif" BorderWidth="0" /><asp:ImageButton ID="BrewingPrevious" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingPrevious.gif" BorderWidth="0" /><asp:ImageButton ID="BrewingNext" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingNext.gif" BorderWidth="0" /><asp:Image ID="WhatsBrewingRS" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingRightSpacer.gif" BorderWidth="0" /><br />--%>

 

I'm supposed to be fixing this ASP.NET site that someone else built and we don't have the project for it.

 

But I honestly don't know that much about the technology.

  • 3 weeks later...
Posted
Are the following lines comments or exectuable code in an ASP.NET file?

 

<!-- #include file='~/imageswap.html' -->
<!--<asp:HyperLink ID="HyperLink10" runat="server" NavigateUrl="~/About/BrucesBrew.aspx"><asp:Image ID="WhatsBrewingPhoto" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingPhoto01.jpg" BorderWidth="0" /></asp:HyperLink> -->
<%--<asp:Image ID="WhatsBrewingLS" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingLeftSpacer.gif" BorderWidth="0" /><asp:ImageButton ID="BrewingPrevious" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingPrevious.gif" BorderWidth="0" /><asp:ImageButton ID="BrewingNext" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingNext.gif" BorderWidth="0" /><asp:Image ID="WhatsBrewingRS" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingRightSpacer.gif" BorderWidth="0" /><br />--%>

 

I'm supposed to be fixing this ASP.NET site that someone else built and we don't have the project for it.

 

But I honestly don't know that much about the technology.

 

I know this is a semi-old thread (sort of), but I wanted to answer it, so others aren't confused.

 

<!-- #include file='~/imageswap.html' -->

This line will include a file for you. Since there's a tilde (~) and the beginning, it will start at the root and go through the directory structure to your location. So this is looking for imageswap.html in the root of the website.

 

<!--<asp:HyperLink ID="HyperLink10" runat="server" NavigateUrl="~/About/BrucesBrew.aspx"><asp:Image ID="WhatsBrewingPhoto" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingPhoto01.jpg" BorderWidth="0" /></asp:HyperLink> -->

This line will process your ASP.NET object (in this case, two HyperLinks and an Image) but when it processes it, it will be placed in a comment block and be invisible to the visitor. Viewing the source of the page will still yield HTML code associated with this.

 

<%--<asp:Image ID="WhatsBrewingLS" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingLeftSpacer.gif" BorderWidth="0" /><asp:ImageButton ID="BrewingPrevious" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingPrevious.gif" BorderWidth="0" /><asp:ImageButton ID="BrewingNext" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingNext.gif" BorderWidth="0" /><asp:Image ID="WhatsBrewingRS" runat="server" ImageUrl="~/Images/Common/Extras/WhatsBrewing/WhatsBrewingRightSpacer.gif" BorderWidth="0" /><br />--%>

Finally, this line will COMPLETELY ignore any code. I don't even think it's processed on the server's end.

 

Since HTML is client-side, ASP.NET objects are processed before being displayed, so <%-- --%> is to ASP.NET as <!-- --> is to HTML.

 

I hope this helps!

 

~Derek

Check out my blog! DevPaper.NET
Posted

Thanks Derek,

 

This is an ongoing project that I occasionally get a call to do some fixes or updates to (you are welcome to take over, if you are interested).

 

I tried removing these lines, thinking they were comments, and the page simply did not work. I new there was something else involved, but symbols (like <!-- --> and <%-- --%>) are difficult to look up in a search engine.

Posted
Thanks Derek,

 

This is an ongoing project that I occasionally get a call to do some fixes or updates to (you are welcome to take over, if you are interested).

 

I tried removing these lines, thinking they were comments, and the page simply did not work. I new there was something else involved, but symbols (like <!-- --> and <%-- --%>) are difficult to look up in a search engine.

 

I hear you on that one!

 

I'm glad I came across this post, though. Gives me a topic to blog about :D

 

~Derek

Check out my blog! DevPaper.NET

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...