I would like to create an ASP.Net page without all the codebehind and designer stuff. Basically I want to go back to ASP classic, but keep the CLR and Base Class Library that makes .Net oh-so-wonderful. I'd like just a page something like this:
<html> <body> <div> <% int customerID = Request.QueryString["CustomerID"]; //Customer and DataAccess classes come from an extenal assembly Customer customer = DataAccess.GetCustomer(customerID); %> You asked for Customer with ID: <%=customerID;%><br /> Name: <%=customer.Name;%><br /> Phone: <%=customer.Phone;%><br /> </div> </body> </html>
However there seem to be some problems with that.
You don't need to do anything in code-behind if you don't want to.
To import namespaces, use an import directive:
<%@ Import namespace="System.Web" %>
To import external libraries, use an Assembly directive:
<%@ Assembly Name="YourAssemblyName" %>
Importing System.Web will allow you intellisense access to the HttpContext.Current.Request
object. It will also give you intellisense for any other objects in that namespace, just like a code file.
I think your best bet is to look at ASP.NET MVC, specifically with the Razor View Engine.
You will still have some tooling around this though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With