Saturday, March 31, 2012

Single asp script without ddl files etc.

I have a rather silly question: I have been trained in both ASP.NET aswell as PHP and was wondering if ASP.NET always has to be compiled intoa project etc. to be implimented. Let me illustrate:
Say I have a completely static website, nothing but XHMTL and CSS,however I have a contact form that needs to be submitted in an htmlmail for some reason, thus some coding is required (this is a randomexample, I could as well have said I want a counter on the front pageto increment a value in the database)
Now I was wondering if it is possible to impliment asp.net just forthat page, like you would do in php. all the other files would benormal html files, but the contact form one then would be contact.php(or at least the action would go to a php file). So is it possible tosend the form to an asp.net script or to implement some asp.net in themiddle of a page without builing a project and thus having to convertall html pages to aspx?
I hope this is clear, i'm basically asking if I can implement asp.net as loosely as PHP and if so, how?
Many thanks!
Sure, you can have just one page in your application be in asp.net (.aspx file), and the rest be HTML files.
Marcie
ASP, ASP.NET, ASP.NET 2.0, PHP, ColdFusion, they are all controlled through ISAPI filters. You dont enable asp on a file level. It runs for a "site" which adds the ISAPI filter to instruct IIS what to do, when it comes across a file with an aspx extension.
It should work no differently than PHP does when it comes across a file with a .php extension. IIS doesnt know or care, it's the compiled framework that then renders your "coded" pages into html pages to send to the browser.
Hope that helps.

Thanks for replying guys! Yeah it does help, but I do suppose that Ihave to write all the code in line then in script blocks? Nocode-behind and such?

You can still use code-behind, the only files VS.NET will compile up for you will be the ASPX page, the HTML pages will still be just that.
Marcie

0 comments:

Post a Comment