Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - HTML Extension for ASP.NET 2.0

 
Thread Tools Search this Thread
Old 07-19-2005, 06:21 PM   #1
Default HTML Extension for ASP.NET 2.0


I am trying to map ASP.NET execution to the ".html" extension. And I am
encountering a strange error. I'm looking for help configuring my
".html" pages to execute as ".aspx" pages.

I have added the IIS file extension mapping, I have also added the
following to the Web.Config file:

<compilation>
<buildProviders>
<add extension=".html"
type="System.Web.Compilation.PageBuildProvider"
appliesTo="Web" />
</buildProviders>
</compilation>
<httpHandlers>
<add path="*.html"
verb="*"
type="System.Web.UI.PageHandlerFactory"
validate="True" />
</httpHandlers>

In my .html pages I receive a context error (example: "'Context' is not
a member of 'Default4'"), yet my page is wired up just like any other
normal aspx page, which do not receive any error.

Example file names: Default4.html, Default4.html.vb

Please help!

Thanks.



guppywon
  Reply With Quote
Old 07-19-2005, 08:11 PM   #2
Brock Allen
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

I just setup an application just as you've described and it works just fine
for me. I'm using Beta2. Perhaps there's something else going on?

-Brock
DevelopMentor
http://staff.develop.com/ballen



> I am trying to map ASP.NET execution to the ".html" extension. And I
> am encountering a strange error. I'm looking for help configuring my
> ".html" pages to execute as ".aspx" pages.
>
> I have added the IIS file extension mapping, I have also added the
> following to the Web.Config file:
>
> <compilation>
> <buildProviders>
> <add extension=".html"
> type="System.Web.Compilation.PageBuildProvider"
> appliesTo="Web" />
> </buildProviders>
> </compilation>
> <httpHandlers>
> <add path="*.html"
> verb="*"
> type="System.Web.UI.PageHandlerFactory"
> validate="True" />
> </httpHandlers>
> In my .html pages I receive a context error (example: "'Context' is
> not a member of 'Default4'"), yet my page is wired up just like any
> other normal aspx page, which do not receive any error.
>
> Example file names: Default4.html, Default4.html.vb
>
> Please help!
>
> Thanks.
>




  Reply With Quote
Old 07-19-2005, 09:18 PM   #3
guppywon
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

Interesting. I am also using Beta2. How are you running your pages? Do
they have to be precompiled, or can I run them uncompiled as usual?

  Reply With Quote
Old 07-19-2005, 09:25 PM   #4
Brock Allen
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

I ran w/o precompile using Cassini (the built-in development webserver).

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Interesting. I am also using Beta2. How are you running your pages? Do
> they have to be precompiled, or can I run them uncompiled as usual?
>




  Reply With Quote
Old 07-19-2005, 10:11 PM   #5
Juan T. Llibre
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

It looks like the "appliesTo" and "validate"
properties have been deprecated.

Try :

<compilation>
<buildProviders>
<add extension=".html"
type="System.Web.Compilation.PageBuildProvider"
/>
</buildProviders>
</compilation>
<httpHandlers>
<add path="*.html"
verb="*"
type="System.Web.UI.PageHandlerFactory"
/>
</httpHandlers>

And , of course, add the file type in the "configuration" option
for the application in the Internet Service Manager.

That's the way I set up my custom extension ".juan"

Check it out :

http://asp.net.do/test/version.juan



Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"guppywon" <> wrote in message
news: oups.com...
>I am trying to map ASP.NET execution to the ".html" extension. And I am
> encountering a strange error. I'm looking for help configuring my
> ".html" pages to execute as ".aspx" pages.
>
> I have added the IIS file extension mapping, I have also added the
> following to the Web.Config file:
>
> <compilation>
> <buildProviders>
> <add extension=".html"
> type="System.Web.Compilation.PageBuildProvider"
> appliesTo="Web" />
> </buildProviders>
> </compilation>
> <httpHandlers>
> <add path="*.html"
> verb="*"
> type="System.Web.UI.PageHandlerFactory"
> validate="True" />
> </httpHandlers>
>
> In my .html pages I receive a context error (example: "'Context' is not
> a member of 'Default4'"), yet my page is wired up just like any other
> normal aspx page, which do not receive any error.
>
> Example file names: Default4.html, Default4.html.vb
>
> Please help!
>
> Thanks.
>



  Reply With Quote
Old 07-20-2005, 12:53 PM   #6
guppywon
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

The context error I am receiving is in Visual Studio 2005, and I am
trying to run the site using IIS. Do I need to do anything within
Visual Studio to support .html, or are my pages going to be
second-class citizens as with VS2003?

  Reply With Quote
Old 07-20-2005, 01:59 PM   #7
Juan T. Llibre
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

I don't understand your problem.

If your problem is that you want to create Html pages, go to the
File menu, then New, File, and select the HTML Page template.

Simply adding the "L" to the default .HTM filename lets you
build HTML pages and you'll have standard HTML objects
at your disposal which you can include in your HTML page.

Any HTML object which you insert will have a set of properties
which you can define in the Visual Studio Property box.

If you want to write JavaScript, you can do that, too,
although there's no additional help for that.

So, support for HTML files *is* there.

If your problem is that you want HTML files processed by
the ASP.NET engine, you *can* do that as I showed you.

I don't know of any way for Visual Studio to recognize custom
file extensions so that Intellisense, etc., work when a custom
extension is loaded ( Is that what you consider the problem to be ?).

You might workaround that by writing your code in an aspx file,
and renaming the file to the html extension when it's working.

If you setup the html extension per the instructions I sent you,
the pages *will* run, since your clients won't be using VS.NET
to run your pages, but their browsers.

Bottom line: VS.NET is behaving as it should, as I see it.

If you differ, please explain what you
would like VS.NET to do with HTML files.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"guppywon" <> wrote in message
news: oups.com...
> The context error I am receiving is in Visual Studio 2005, and I am
> trying to run the site using IIS. Do I need to do anything within
> Visual Studio to support .html, or are my pages going to be
> second-class citizens as with VS2003?
>



  Reply With Quote
Old 07-20-2005, 02:02 PM   #8
Brock Allen
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

I don't have the rest of this thread, but I seem to recall that you said
you made the mappings in IIS for .html files to the ASP.NET ISAPI (make sure
it's the 2.0 version).

Just to see if everything's ok, I'd suggest starting from scratch. Make a
FileSystem project (that was you don't have IIS to worry about) and make
a simple .aspx and then switch it all over to .html and see if that works.
I'm thinking that you'll have to take these little steps to isolate the problem.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> The context error I am receiving is in Visual Studio 2005, and I am
> trying to run the site using IIS. Do I need to do anything within
> Visual Studio to support .html, or are my pages going to be
> second-class citizens as with VS2003?
>




  Reply With Quote
Old 07-20-2005, 09:58 PM   #9
guppywon
 
Posts: n/a
Default Re: HTML Extension for ASP.NET 2.0

I was finally able to get it to work. I accidently misconfigured IIS,
and simply had to fix the mistake.

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump