Skip to content

Commit 1b48742

Browse files
author
Manoj Sethi
committed
Application Life Cylce Events
1 parent ada86c8 commit 1b48742

12 files changed

Lines changed: 459 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestLifeCycle", "RequestLifeCycle\RequestLifeCycle.csproj", "{E1A6A0D9-BA4E-404C-85C0-FA35D88BA6CD}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{E1A6A0D9-BA4E-404C-85C0-FA35D88BA6CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E1A6A0D9-BA4E-404C-85C0-FA35D88BA6CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E1A6A0D9-BA4E-404C-85C0-FA35D88BA6CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E1A6A0D9-BA4E-404C-85C0-FA35D88BA6CD}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace RequestLifeCycle
9+
{
10+
public class RouteConfig
11+
{
12+
public static void RegisterRoutes(RouteCollection routes)
13+
{
14+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15+
16+
routes.MapRoute(
17+
name: "Default",
18+
url: "{controller}/{action}/{id}",
19+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20+
);
21+
}
22+
}
23+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
7+
namespace RequestLifeCycle.Controllers
8+
{
9+
public class HomeController : Controller
10+
{
11+
public string Index()
12+
{
13+
return "Hello From Index";
14+
}
15+
}
16+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="RequestLifeCycle.MvcApplication" Language="C#" %>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Diagnostics;
2+
using System.Web.Mvc;
3+
using System.Web.Routing;
4+
5+
namespace RequestLifeCycle
6+
{
7+
public class MvcApplication : System.Web.HttpApplication
8+
{
9+
protected void Application_Start()
10+
{
11+
AreaRegistration.RegisterAllAreas();
12+
RouteConfig.RegisterRoutes(RouteTable.Routes);
13+
}
14+
15+
protected void Application_BeginRequest()
16+
{
17+
Debug.WriteLine("Begin Request");
18+
}
19+
20+
protected void Application_MapRequestHandler()
21+
{
22+
Debug.WriteLine("Map Handler");
23+
}
24+
25+
protected void Application_PostMapRequestHandler()
26+
{
27+
Debug.WriteLine("Post Map Handler");
28+
}
29+
30+
protected void Application_AcquireRequestState()
31+
{
32+
Debug.WriteLine("Request State");
33+
}
34+
35+
protected void Application_PreRequestHandlerExecute()
36+
{
37+
Debug.WriteLine("Pre Handler Execute");
38+
}
39+
40+
protected void Application_PostRequestHandlerExecute()
41+
{
42+
Debug.WriteLine("Post Handler Execute");
43+
}
44+
45+
protected void Application_EndRequest()
46+
{
47+
Debug.WriteLine("End Request");
48+
}
49+
}
50+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("RequestLifeCycle")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("RequestLifeCycle")]
13+
[assembly: AssemblyCopyright("Copyright © 2016")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("e1a6a0d9-ba4e-404c-85c0-fa35d88ba6cd")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
4+
<Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
5+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
6+
<PropertyGroup>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<ProductVersion>
10+
</ProductVersion>
11+
<SchemaVersion>2.0</SchemaVersion>
12+
<ProjectGuid>{E1A6A0D9-BA4E-404C-85C0-FA35D88BA6CD}</ProjectGuid>
13+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
14+
<OutputType>Library</OutputType>
15+
<AppDesignerFolder>Properties</AppDesignerFolder>
16+
<RootNamespace>RequestLifeCycle</RootNamespace>
17+
<AssemblyName>RequestLifeCycle</AssemblyName>
18+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
19+
<UseIISExpress>true</UseIISExpress>
20+
<IISExpressSSLPort />
21+
<IISExpressAnonymousAuthentication />
22+
<IISExpressWindowsAuthentication />
23+
<IISExpressUseClassicPipelineMode />
24+
<UseGlobalApplicationHostFile />
25+
<NuGetPackageImportStamp>
26+
</NuGetPackageImportStamp>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
29+
<DebugSymbols>true</DebugSymbols>
30+
<DebugType>full</DebugType>
31+
<Optimize>false</Optimize>
32+
<OutputPath>bin\</OutputPath>
33+
<DefineConstants>DEBUG;TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
38+
<DebugType>pdbonly</DebugType>
39+
<Optimize>true</Optimize>
40+
<OutputPath>bin\</OutputPath>
41+
<DefineConstants>TRACE</DefineConstants>
42+
<ErrorReport>prompt</ErrorReport>
43+
<WarningLevel>4</WarningLevel>
44+
</PropertyGroup>
45+
<ItemGroup>
46+
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
47+
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
48+
<Private>True</Private>
49+
</Reference>
50+
<Reference Include="Microsoft.CSharp" />
51+
<Reference Include="System.Web.DynamicData" />
52+
<Reference Include="System.Web.Entity" />
53+
<Reference Include="System.Web.ApplicationServices" />
54+
<Reference Include="System.ComponentModel.DataAnnotations" />
55+
<Reference Include="System" />
56+
<Reference Include="System.Data" />
57+
<Reference Include="System.Core" />
58+
<Reference Include="System.Data.DataSetExtensions" />
59+
<Reference Include="System.Web.Extensions" />
60+
<Reference Include="System.Xml.Linq" />
61+
<Reference Include="System.Drawing" />
62+
<Reference Include="System.Web" />
63+
<Reference Include="System.Xml" />
64+
<Reference Include="System.Configuration" />
65+
<Reference Include="System.Web.Services" />
66+
<Reference Include="System.EnterpriseServices" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<Reference Include="System.Web.Razor">
70+
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
71+
</Reference>
72+
<Reference Include="System.Web.Webpages">
73+
<HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.dll</HintPath>
74+
</Reference>
75+
<Reference Include="System.Web.Webpages.Deployment">
76+
<HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Deployment.dll</HintPath>
77+
</Reference>
78+
<Reference Include="System.Web.Webpages.Razor">
79+
<HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Razor.dll</HintPath>
80+
</Reference>
81+
<Reference Include="System.Web.Helpers">
82+
<HintPath>..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
83+
</Reference>
84+
<Reference Include="Microsoft.Web.Infrastructure">
85+
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
86+
</Reference>
87+
<Reference Include="System.Web.Mvc">
88+
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
89+
</Reference>
90+
</ItemGroup>
91+
<ItemGroup>
92+
<Content Include="Global.asax" />
93+
<Content Include="Web.config" />
94+
</ItemGroup>
95+
<ItemGroup>
96+
<Compile Include="App_Start\RouteConfig.cs" />
97+
<Compile Include="Controllers\HomeController.cs" />
98+
<Compile Include="Global.asax.cs">
99+
<DependentUpon>Global.asax</DependentUpon>
100+
</Compile>
101+
<Compile Include="Properties\AssemblyInfo.cs" />
102+
</ItemGroup>
103+
<ItemGroup>
104+
<Content Include="Views\web.config" />
105+
<Content Include="packages.config" />
106+
<None Include="Web.Debug.config">
107+
<DependentUpon>Web.config</DependentUpon>
108+
</None>
109+
<None Include="Web.Release.config">
110+
<DependentUpon>Web.config</DependentUpon>
111+
</None>
112+
</ItemGroup>
113+
<ItemGroup>
114+
<Folder Include="App_Data\" />
115+
<Folder Include="Models\" />
116+
<Folder Include="Views\Home\" />
117+
</ItemGroup>
118+
<PropertyGroup>
119+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
120+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
121+
</PropertyGroup>
122+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
123+
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
124+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
125+
<ProjectExtensions>
126+
<VisualStudio>
127+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
128+
<WebProjectProperties>
129+
<UseIIS>True</UseIIS>
130+
<AutoAssignPort>True</AutoAssignPort>
131+
<DevelopmentServerPort>53120</DevelopmentServerPort>
132+
<DevelopmentServerVPath>/</DevelopmentServerVPath>
133+
<IISUrl>http://localhost:53120/</IISUrl>
134+
<NTLMAuthentication>False</NTLMAuthentication>
135+
<UseCustomServer>False</UseCustomServer>
136+
<CustomServerUrl>
137+
</CustomServerUrl>
138+
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
139+
</WebProjectProperties>
140+
</FlavorProperties>
141+
</VisualStudio>
142+
</ProjectExtensions>
143+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
144+
<PropertyGroup>
145+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
146+
</PropertyGroup>
147+
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
148+
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
149+
</Target>
150+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
151+
Other similar extension points exist, see Microsoft.Common.targets.
152+
<Target Name="BeforeBuild">
153+
</Target>
154+
<Target Name="AfterBuild">
155+
</Target>
156+
-->
157+
</Project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0"?>
2+
3+
<configuration>
4+
<configSections>
5+
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
6+
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
7+
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
8+
</sectionGroup>
9+
</configSections>
10+
11+
<system.web.webPages.razor>
12+
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
13+
<pages pageBaseType="System.Web.Mvc.WebViewPage">
14+
<namespaces>
15+
<add namespace="System.Web.Mvc" />
16+
<add namespace="System.Web.Mvc.Ajax" />
17+
<add namespace="System.Web.Mvc.Html" />
18+
<add namespace="System.Web.Routing" />
19+
<add namespace="RequestLifeCycle" />
20+
</namespaces>
21+
</pages>
22+
</system.web.webPages.razor>
23+
24+
<appSettings>
25+
<add key="webpages:Enabled" value="false" />
26+
</appSettings>
27+
28+
<system.webServer>
29+
<handlers>
30+
<remove name="BlockViewHandler"/>
31+
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
32+
</handlers>
33+
</system.webServer>
34+
35+
<system.web>
36+
<compilation>
37+
<assemblies>
38+
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
39+
</assemblies>
40+
</compilation>
41+
</system.web>
42+
</configuration>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
4+
5+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6+
<!--
7+
In the example below, the "SetAttributes" transform will change the value of
8+
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
9+
finds an attribute "name" that has a value of "MyDB".
10+
11+
<connectionStrings>
12+
<add name="MyDB"
13+
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14+
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15+
</connectionStrings>
16+
-->
17+
<system.web>
18+
<!--
19+
In the example below, the "Replace" transform will replace the entire
20+
<customErrors> section of your web.config file.
21+
Note that because there is only one customErrors section under the
22+
<system.web> node, there is no need to use the "xdt:Locator" attribute.
23+
24+
<customErrors defaultRedirect="GenericError.htm"
25+
mode="RemoteOnly" xdt:Transform="Replace">
26+
<error statusCode="500" redirect="InternalError.htm"/>
27+
</customErrors>
28+
-->
29+
</system.web>
30+
</configuration>

0 commit comments

Comments
 (0)