ASP.Net without codebehind

I would like to create an ASP.Net page without any code or constructor thing. Basically, I want to get back to the ASP classics, but keep the CLR and the core library of classes that make .Net awesome. I would like the page to be 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 this.

  • Request Page. codebehind designer.
  • intellisense
  • - , , ?
  • , extenal.
+3
3

, .

, :

<%@ Import namespace="System.Web" %>

, Assembly:

<%@ Assembly Name="YourAssemblyName" %>

System.Web HttpContext.Current.Request. intellisense , .

+7

, ASP.NET MVC, , Razor View Engine.

.

+5

HttpContext.Current.Request will provide you a request.

+1
source

Source: https://habr.com/ru/post/1764075/


All Articles