I am new to C# and working on a project with sitecore
i just added a aspx page with the
.aspx file:
<sc:sublayout runat="server" renderingid="{7ACDFB04-E9C9-4AC4-BDC6-6F3FF0862199}" path="/layouts/FSB/Header.ascx" id="HeaderFixed"></sc:sublayout>
<sc:placeholder runat="server" key="layout" id="templatePage"></sc:placeholder>
<sc:sublayout runat="server" renderingid="{621A56F6-9948-4661-9F33-3AFEF1DE698D}" path="/layouts/FSB/Footer.ascx" id="FooterFixed"></sc:sublayout>
.cs file
Control templateControl = LoadControl("templateLandingPages/free_template.ascx");
Control placeHolderControl = Page.FindControl("templatePage");
Error in browser shows for line no 16:
Illegal characters in path.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Illegal characters in path.
Source Error:
Line 14: protected void Page_Load(object sender, EventArgs e)
Line 15: {
Line 16: Control templateControl = LoadControl("templateLandingPages\free_template.ascx");
Line 17: Control placeHolderControl = Page.FindControl("templatePage");
Simple matter of how you use your
\. You need to double up on the slash (\\). The first one acts as an escape character for the second one.As commented, you can also use:
Check out this article on string literals and why you would use one notation over the other.