Code Monkey home page Code Monkey logo

corewebforms's Introduction

WebForms on ASP.NET Core

The goal of this project is to explore building some of the basic building blocks of the WebForms on ASP.NET Core. This will isolate out the actual components needed to build a functional page.

Supported so far:

  • System.Web.IHttpHandler
  • System.Web.UI.Page
  • System.Web.UI.HtmlTextWriter
  • System.Web.UI.HtmlControls.*
  • System.Web.UI.WebControls.*
  • System.Web.Routing.*
  • Master pages
  • Compilation of aspx pages (both VB and C#)
  • Binary compatibility with System.Web.dll and System.Web.Extensions.dll (if the API exists)
  • ScriptManager and ajax support
  • System.Web.Optimization

What is NOT supported:

  • Designer support
  • System.Web hosting model
  • System.Web membership model
  • Any System.Web concept not called out as in scope

This will make use of Microsoft.AspNetCore.SystemWebAdapters to provide the System.Web.HttpContext that is at the core of the WebForms pipeline.

Get Started

Important

The feed URL has changed as of 2 April, 2024

  1. Add a nuget.config or update yours to have the ci feed:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <!--To inherit the global NuGet package sources remove the <clear/> line below -->
        <clear />
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
        <add key="corewebforms" value="https://corewebformsfeed.blob.core.windows.net/feed/index.json" />
      </packageSources>
    </configuration>
  2. Create a .NET 8 project similar to the following with the WebForms SDK:

    <Project Sdk="CoreWebForms.Sdk/0.2.1">
    
        <PropertyGroup>
            <TargetFrameworks>net8.0</TargetFrameworks>
            <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
            <!-- Optional, but easier to debug at runtime than compile time -->
            <EnableRuntimeAspxCompilation>true</EnableRuntimeAspxCompilation>
        </PropertyGroup>
    
    </Project>
  3. Add WebForms to your services (this automatically will add the System.Web adapters - this can be configured independently if needed)

        builder.Services.AddSystemWebAdapters()
            .AddPreApplicationStartMethod(false) // Used if you want to run any pre application start methods
            .AddJsonSessionSerializer()
            .AddWrappedAspNetCoreSession()
            .AddRouting()
            .AddWebForms()
            .AddScriptManager() // Remove if you don't use ScriptManager/AJAX
            .AddOptimization() // Remove if you don't use System.Web.Optimization
            .AddDynamicPages() // Used if you have dynamic pages
            .AddCompiledPages(); // Used if compiled pages are used
    
    builder.Services.AddSession();
    builder.Services.AddDistributedMemoryCache();
  4. Add the System.Web middleware and map endpoints:

    ...
    app.UseSession();
    app.UseSystemWebAdapters();
    ...
    app.MapHttpHandlers(); // Required for pages (or other configured handlers)
    app.MapScriptManager(); // Required if you want to use ScriptManager
    app.MapBundleTable(); // Required if you want to use BundleTable.Bundles
  5. Add any .aspx or .aspx.cs/.aspx.vb files to your project. They should be served up as expected when you run.

Samples

For samples, please go to the samples repo for up-to-date examples.

Design docs

Please see the design docs to see the designs and plans for how this are expected to work.

corewebforms's People

Contributors

twsouthwick avatar dependabot[bot] avatar birojnayak avatar code-dj avatar kschlobohm avatar coderandhiker avatar gumbarros avatar thejaymann avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.