Skip to content

Commit ce2e90f

Browse files
csharpfritzCopilot
andcommitted
Add ContosoUniversity Web Forms sample with local setup
Add the ContosoUniversity ASP.NET Web Forms sample project as a reference application for BWFC migration testing. Includes: - Full Web Forms source (5 pages: Home, About, Students, Courses, Instructors) - Connection strings updated from SQLEXPRESS to LocalDB - AjaxControlToolkit HintPath fixed to use NuGet packages folder - Empty Directory.Build.props to block repo-root NBGV inheritance - Screenshots of all 5 pages running on IIS Express - Setup guide documenting prerequisites and reproduction steps Controls observed: GridView, DetailsView, DropDownList, AutoCompleteExtender, Master Page navigation menu. Database uses EF6 Database-First (.edmx). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c51d88f commit ce2e90f

71 files changed

Lines changed: 4718 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
949 KB
Loading
679 KB
Loading
121 KB
Loading
681 KB
Loading
1.63 MB
Loading
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# ContosoUniversity Web Forms — Local Setup Guide
2+
3+
> Reference setup for the ASP.NET Web Forms sample application used by the BWFC migration showcase.
4+
5+
## Prerequisites
6+
7+
| Tool | Required | Location on Build Machine |
8+
|------|----------|--------------------------|
9+
| **IIS Express** || `C:\Program Files\IIS Express\iisexpress.exe` |
10+
| **SQL Server LocalDB** || Instance `MSSQLLocalDB` (SQL Server 2022 / v17.0) |
11+
| **MSBuild 18.x** (with WebApplication targets) || `C:\Program Files\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin\MSBuild.exe` |
12+
| **NuGet CLI** || `D:\BlazorWebFormsComponents\nuget.exe` (repo-root) |
13+
| **sqlcmd** || `C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\SQLCMD.EXE` |
14+
15+
> **Note:** MSBuild from VS 2017 BuildTools (v15.0) lacks `Microsoft.WebApplication.targets` and cannot build this project. Use MSBuild from Visual Studio 18 Insiders (or any VS edition that includes web workloads).
16+
17+
## Step-by-Step Reproduction
18+
19+
### 1. Start LocalDB and Attach the Database
20+
21+
```powershell
22+
sqllocaldb start MSSQLLocalDB
23+
24+
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "
25+
CREATE DATABASE ContosoUniversity
26+
ON (FILENAME = 'D:\BlazorWebFormsComponents\samples\ContosoUniversity\ContosoUniversity\App_Data\ContosoUniversity.mdf')
27+
FOR ATTACH_REBUILD_LOG;
28+
"
29+
```
30+
31+
The `.mdf` ships from an older SQL Server version (internal version 782). LocalDB auto-upgrades it to version 998 and creates a new log file.
32+
33+
### 2. Restore NuGet Packages
34+
35+
```powershell
36+
cd samples\ContosoUniversity
37+
..\..\nuget.exe restore ContosoUniversity.sln
38+
```
39+
40+
### 3. Build
41+
42+
```powershell
43+
& "C:\Program Files\Microsoft Visual Studio\18\Insiders\MSBuild\Current\Bin\MSBuild.exe" `
44+
ContosoUniversity\ContosoUniversity.csproj `
45+
/p:Configuration=Debug /v:minimal
46+
```
47+
48+
### 4. Launch IIS Express
49+
50+
```powershell
51+
& "C:\Program Files\IIS Express\iisexpress.exe" `
52+
/path:"D:\BlazorWebFormsComponents\samples\ContosoUniversity\ContosoUniversity" `
53+
/port:44380
54+
```
55+
56+
Base URL: **http://localhost:44380/**
57+
58+
Press `Q` in the IIS Express console to stop the server.
59+
60+
### 5. Verify Pages
61+
62+
Navigate to each page to confirm the app is working:
63+
64+
| Page | URL | Status |
65+
|------|-----|--------|
66+
| Home | `/Home.aspx` | ✅ Working |
67+
| About | `/About.aspx` | ✅ Working |
68+
| Students | `/Students.aspx` | ✅ Working |
69+
| Courses | `/Courses.aspx` | ✅ Working |
70+
| Instructors | `/Instructors.aspx` | ✅ Working |
71+
72+
## Screenshot Inventory
73+
74+
All screenshots captured from the running application are stored in `dev-docs/contoso-screenshots/`:
75+
76+
| Screenshot | Page | Key Controls Observed |
77+
|-----------|------|-----------------------|
78+
| `home.png` | Home.aspx | Navigation menu, welcome content |
79+
| `about.png` | About.aspx | **GridView** — enrollment statistics (11 date rows) |
80+
| `students.png` | Students.aspx | **GridView** (11 students), **DetailsView** (Add Student form), AutoCompleteExtender search |
81+
| `courses.png` | Courses.aspx | **DropDownList** (department filter), AutoCompleteExtender name search, empty-state GridView |
82+
| `instructors.png` | Instructors.aspx | **GridView** (7 instructors with sortable columns) |
83+
84+
## Issues Encountered & Fixes
85+
86+
### 1. Duplicate AssemblyVersion Attributes
87+
88+
**Problem:** The repo-root `Directory.Build.props` injects `Nerdbank.GitVersioning 3.9.50` into all projects. For this legacy .NET Framework 4.5.2 project with a manual `AssemblyInfo.cs`, the auto-generated attributes conflict with the hand-coded ones.
89+
90+
**Fix:** Created an empty `samples/ContosoUniversity/Directory.Build.props` to block inheritance from the repo root.
91+
92+
### 2. Missing AjaxControlToolkit Assembly
93+
94+
**Problem:** The `.csproj` HintPath pointed to a non-existent `Documents\ASP.NET AJAX Control Toolkit\` folder.
95+
96+
**Fix:** Installed `AjaxControlToolkit 16.1.1` via NuGet and updated the HintPath in the `.csproj` to `packages\AjaxControlToolkit.16.1.1.0\lib\net40\AjaxControlToolkit.dll`.
97+
98+
### 3. Connection String Update
99+
100+
**Problem:** Original `Web.config` connection strings referenced `.\SQLEXPRESS`, which is not available on the build machine.
101+
102+
**Fix:** Updated both connection strings (`SchoolContext` and `DefaultConnection`) to use `(localdb)\MSSQLLocalDB`.
103+
104+
### 4. Database Version Upgrade
105+
106+
**Problem:** The shipped `.mdf` is from an older SQL Server version (internal version 782). The original `.ldf` log file was not included.
107+
108+
**Fix:** Used `FOR ATTACH_REBUILD_LOG` which upgrades the data file and creates a fresh log file automatically.
109+
110+
## Project Technical Details
111+
112+
- **Target Framework:** .NET Framework 4.5.2
113+
- **ORM:** Entity Framework 6.1.3 (Database-First, `.edmx` model)
114+
- **AJAX Toolkit:** AjaxControlToolkit 16.1.1
115+
- **Key Controls:** GridView, DetailsView, DropDownList, AutoCompleteExtender, Menu
116+
- **Master Page:** `Site.Master` provides consistent navigation across all pages
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="ContosoUniversity.About" %>
2+
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
3+
<link href="CSS/CSS_About.css" rel="stylesheet" />
4+
<script src="JQuery/JQuery_About.js"></script>
5+
</asp:Content>
6+
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
7+
<div id="header">
8+
<h1> Students Body Statistics </h1>
9+
</div>
10+
<div id="grv">
11+
<asp:GridView CssClass="grid"
12+
ID="EnrollmentsStat"
13+
runat="server" SelectMethod="EnrollmentsStat_GetData"
14+
AutoGenerateColumns="False" EmptyDataText="There are no records to display"
15+
CellPadding="4" ForeColor="#333333" GridLines="None">
16+
<AlternatingRowStyle BackColor="White" />
17+
<Columns>
18+
<asp:BoundField DataField="Key" HeaderText="Enrollment Date" ReadOnly="True">
19+
<HeaderStyle BackColor="Black" BorderColor="White" BorderStyle="Solid" Font-Bold="True" Font-Size="30px" />
20+
<ItemStyle BorderColor="White" BorderStyle="Solid" Font-Size="20px" HorizontalAlign="Center" />
21+
</asp:BoundField>
22+
<asp:BoundField DataField="Value" HeaderText="Students" ReadOnly="True">
23+
<FooterStyle BorderStyle="Solid" />
24+
<HeaderStyle BackColor="Black" BorderColor="White" BorderStyle="Solid" Font-Bold="True" Font-Size="30px" />
25+
<ItemStyle BorderColor="White" BorderStyle="Solid" Font-Size="20px" HorizontalAlign="Center" />
26+
</asp:BoundField>
27+
</Columns>
28+
<EditRowStyle BackColor="#2461BF" />
29+
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
30+
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
31+
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
32+
<RowStyle BackColor="#EFF3FB" />
33+
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
34+
<SortedAscendingCellStyle BackColor="#F5F7FB" />
35+
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
36+
<SortedDescendingCellStyle BackColor="#E9EBEF" />
37+
<SortedDescendingHeaderStyle BackColor="#4870BE" />
38+
</asp:GridView>
39+
</div>
40+
</asp:Content>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.UI;
6+
using System.Web.UI.WebControls;
7+
8+
using ContosoUniversity.Models;
9+
using ContosoUniversity.Bll;
10+
11+
12+
namespace ContosoUniversity
13+
{
14+
public partial class About : System.Web.UI.Page
15+
{
16+
protected void Page_Load(object sender, EventArgs e)
17+
{
18+
19+
}
20+
21+
// The return type can be changed to IEnumerable, however to support
22+
// paging and sorting, the following parameters must be added:
23+
// int maximumRows
24+
// int startRowIndex
25+
// out int totalRowCount
26+
// string sortByExpression
27+
public Dictionary<string, int> EnrollmentsStat_GetData()
28+
{
29+
return new Enrollmet_Logic().Get_Enrollment_ByDate();
30+
}
31+
}
32+
}

samples/ContosoUniversity/ContosoUniversity/About.aspx.designer.cs

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
3+
<TelemetryModules>
4+
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/>
5+
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
6+
<!--
7+
Use the following syntax here to collect additional performance counters:
8+
9+
<Counters>
10+
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
11+
...
12+
</Counters>
13+
14+
PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
15+
16+
Counter names may only contain letters, round brackets, forward slashes, hyphens, underscores, spaces and dots.
17+
You may provide an optional ReportAs attribute which will be used as the metric name when reporting counter data.
18+
For the purposes of reporting, metric names will be sanitized by removing all invalid characters from the resulting metric name.
19+
20+
NOTE: performance counters configuration will be lost upon NuGet upgrade.
21+
22+
The following placeholders are supported as InstanceName:
23+
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
24+
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
25+
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
26+
-->
27+
</Add>
28+
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
29+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
30+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
31+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
32+
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
33+
<Handlers>
34+
<!--
35+
Add entries here to filter out additional handlers:
36+
37+
NOTE: handler configuration will be lost upon NuGet upgrade.
38+
-->
39+
<Add>System.Web.Handlers.TransferRequestHandler</Add>
40+
<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
41+
<Add>System.Web.StaticFileHandler</Add>
42+
<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
43+
<Add>System.Web.Optimization.BundleHandler</Add>
44+
<Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
45+
<Add>System.Web.Handlers.TraceHandler</Add>
46+
<Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
47+
<Add>System.Web.HttpDebugHandler</Add>
48+
</Handlers>
49+
</Add>
50+
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
51+
</TelemetryModules>
52+
<TelemetryProcessors>
53+
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
54+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
55+
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
56+
</Add>
57+
</TelemetryProcessors>
58+
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
59+
<!--
60+
Learn more about Application Insights configuration with ApplicationInsights.config here:
61+
http://go.microsoft.com/fwlink/?LinkID=513840
62+
63+
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
64+
-->
65+
<TelemetryInitializers>
66+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
67+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DomainNameRoleInstanceTelemetryInitializer, Microsoft.AI.WindowsServer"/>
68+
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
69+
<Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web"/>
70+
<Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
71+
<Filters>
72+
<Add Pattern="(YottaaMonitor|BrowserMob|HttpMonitor|YandexBot|BingPreview|PagePeeker|ThumbShotsBot|WebThumb|URL2PNG|ZooShot|GomezA|Catchpoint bot|Willow Internet Crawler|Google SketchUp|Read%20Later|KTXN|Pingdom|AlwaysOn)"/>
73+
<Add Pattern="Slurp" SourceName="Yahoo Bot"/>
74+
<Add Pattern="(bot|zao|borg|Bot|oegp|silk|Xenu|zeal|^NING|crawl|Crawl|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|^Java/|^JNLP/|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|spider|Spider|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|^voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr\-agent|Squrl Java|A6\-Indexer|netresearch|searchsight|http%20client|Python-urllib|dataparksearch|Screaming Frog|AppEngine-Google|YahooCacheSystem|semanticdiscovery|facebookexternalhit|Google.*/\+/web/snippet|Google-HTTP-Java-Client)"
75+
SourceName="Spider"/>
76+
</Filters>
77+
</Add>
78+
<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
79+
<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
80+
<Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web"/>
81+
<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
82+
<Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web"/>
83+
<Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web"/>
84+
<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
85+
</TelemetryInitializers>
86+
</ApplicationInsights>

0 commit comments

Comments
 (0)