Barebone asp.net

Is it possible to make a web form without using server control, or set the runat attribute on the html control? How do you call code behind a function?

0


source to share


3 answers


You cannot call codebehind functions without the runat = "server" tag at least. If you've created a web service, you can create a clean html / javascript page that communicates with the server via AJAX. These are your two use cases for ASP.Net as far as I know.



+1


source


Yes it is possible. The server runat form is only needed if you are using callbacks and server controls.

If you are not using server-side controls, you should be able to add forms to a page that posts to other pages (it might even post to itself). In your page_load, you will be prohibited from using the usual request.form and request.querystring to fetch form values, but you should be able to call other methods on the page.



If you are familiar with classic ASP, you can do the same with asp.net.

Also consider the MVC framework asp.net ( http://www.asp.net/mvc ). It allows you to use asp.net without using web forms.

+1


source


You can use HTTPHandler to barebone ASP.NET.

You won't have a markup file, you only have a class that runs and provides you with an HttpContext to write to the HTTP stream.

http://msdn.microsoft.com/en-us/library/f3ff8w4a(VS.71).aspx

In fact, HttpHandlers are the building blocks of all .NET web frameworks.

0


source







All Articles