Reputation: 2153
I have a single page application, in .net 4 but created from empty web application (Application web ASP.NET .NET Framework -> empty project). I want to add a simple value to the index.html from server side but not from the api. Can I include c# code into the page?
Upvotes: 0
Views: 61
Reputation: 2153
I first change my web.config to process html file. Enabling processed asp net
After just need to use embedded .net tag
<system.web>
<compilation debug="true" targetFramework="4.0">
<buildProviders>
<add extension =".html" type="System.Web.Compilation.PageBuildProvider"/>
<add extension =".htm" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
</compilation>
<system.webServer>
<handlers>
<add name="HTML" path="*.html" verb="GET, HEAD, POST, DEBUG"
type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script"/>
<add name="HTM" path="*.htm" verb="GET, HEAD, POST, DEBUG"
type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" requireAccess="Script"/>
</handlers>
</system.webServer>
Upvotes: 1