how do write asp.net code into html page

Posted by Kannan1986 under ASP.NET on 2/6/2010 | Views : 11683 | Status : [Member] | Replies : 5
how do write asp.net code into html page




Responses

Posted by: Poster on: 2/6/2010 [Member] Starter

Up
0
Down
ASP.NET code can't be written (can be written but will not work) in the page whose extension is anything except .aspx. So if you want to write asp.net code you will have to write into .aspx page.

I would suggest to go through http://www.dotnetfunda.com/tutorials/controls/ link and download the sample projects to understand how asp.net page works.

Thank you.

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/6/2010 [Member] Bronze

Up
0
Down
It is not possible as aspx page need so many view states to load the page whereas HTML page gets load easily.
If you write simple Hello World in aspx page and in HTML page then View the source for that pages in browser you will get your answer...

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/7/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Hey.. Nothing is impossible guys...

Do the following :
Create an aspx file in your visual studio, and rename its extension to html.

Add an httpHandler entry to the web.config to handle your page for html file.

[Note : You might also create an HttpHandler, and from processRequest you might execute the page directly]

In IIS, remove the html extension and add it again to handle using aspnet_isapi.dll.

I didnt tried for html extension, but worked with lots of other extension, and it worked. I am confident, that this technique will work for htmls as well.

www.abhisheksur.com

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/24/2010 [Member] Bronze

Up
0
Down
asp.net code in html file !!!! then why require aspx ascx files.

That is not possible. Since html compiler is different and asp.net compiler is different

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 2/24/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Actually IIS serves htmls directly to the browser. So you will not find ISAPI filters to htmls. U can use any extension other than html.
See this for better idea :
http://forums.asp.net/p/822291/822291.aspx

Cheers.

www.abhisheksur.com

Kannan1986, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response