How to read web.config settings on .html page?

I am using ASP.NET 3.5 web forms.
I saved my website path in a web.config file called "CommonPath".
Now I have one simple html page and you want to use this key on this static html page. So how can I do this? or is there any other way to do this?

Thanks in advance

0
source share
2 answers

What I did in the past was to register .html pages, which should also be interpreted as dynamic pages. (For example, as ASPX).

This can be done via the "web.config" file:

....
<system.web>
    <compilation ...>
        <buildProviders>
            <add extension=".html" 
                 type="System.Web.Compilation.PageBuildProvider" />
        </buildProviders>
    ....

and

....
<system.webServer>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated" />
        <add name="PageHandlerFactory-Integrated-HTML" path="*.html" 
             verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" 
             resourceType="Unspecified" preCondition="integratedMode" />
    </handlers>
....

Robert, IIS 7 IIS 7.5 (, , ). IIS 6, IIS.

+2

: .html .aspx, ASP.NET IIS, . - . .html , ( IIS), .html .aspx, -; , , ASP.NET .

+1

All Articles