forked from elastic/apm-agent-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build and run the new sample project standalone, not in IIS Express in powershell run Get-EtwTraceSession -Name EtwSessionForCLRElastic* quit sample project run Get-EtwTraceSession -Name EtwSessionForCLRElastic* again you'll see there is a leftover Etw Trace Session
- Loading branch information
Will Gunn
committed
Jan 12, 2021
1 parent
cc900c4
commit b1ea19a
Showing
78 changed files
with
27,310 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
sample/SampleAspNetCoreTargetingFrameworkApp/Areas/MyArea/Controllers/HomeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to Elasticsearch B.V under | ||
// one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace SampleAspNetCoreApp.Areas.MyArea.Controllers | ||
{ | ||
[Area("MyArea")] | ||
public class HomeController : Controller | ||
{ | ||
// GET | ||
public IActionResult Index() => View(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
sample/SampleAspNetCoreTargetingFrameworkApp/Areas/MyArea/Views/Home/Index.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@{ | ||
ViewData["Title"] = "MyArea Home Page"; | ||
} | ||
@model List<string> | ||
|
||
<br/> | ||
<div class="alert alert-info" role="alert"> | ||
This is an area home page. | ||
</div> | ||
|
16 changes: 16 additions & 0 deletions
16
sample/SampleAspNetCoreTargetingFrameworkApp/Areas/MyOtherArea/Controllers/HomeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to Elasticsearch B.V under | ||
// one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace SampleAspNetCoreApp.Areas.MyOtherArea.Controllers | ||
{ | ||
[Area("MyOtherArea")] | ||
public class HomeController : Controller | ||
{ | ||
// GET | ||
public IActionResult Index() => View(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
sample/SampleAspNetCoreTargetingFrameworkApp/Areas/MyOtherArea/Views/Home/Index.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@{ | ||
ViewData["Title"] = "MyOtherArea Home Page"; | ||
} | ||
@model List<string> | ||
|
||
<br/> | ||
<div class="alert alert-info" role="alert"> | ||
This is another area home page that has its own route. | ||
</div> | ||
|
55 changes: 55 additions & 0 deletions
55
sample/SampleAspNetCoreTargetingFrameworkApp/Controllers/AccountController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Licensed to Elasticsearch B.V under one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace SampleAspNetCoreApp.Controllers | ||
{ | ||
public class AccountController : Controller | ||
{ | ||
private readonly SignInManager<IdentityUser> _signInManager; | ||
private readonly UserManager<IdentityUser> _userManager; | ||
|
||
public AccountController(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signInManager) => | ||
(_userManager, _signInManager) = (userManager, signInManager); | ||
|
||
public IActionResult Login() => View(); | ||
|
||
[HttpPost] | ||
public async Task<IActionResult> LoginUser([FromForm] string userName, [FromForm] string password) | ||
{ | ||
var res = await _signInManager.PasswordSignInAsync(userName, password, true, false); | ||
|
||
if (res.Succeeded) | ||
return Redirect("/Home/Index"); | ||
|
||
return View("Login"); | ||
} | ||
|
||
public IActionResult Register() => View(); | ||
|
||
[HttpPost] | ||
public async Task<IActionResult> RegisterUser([FromForm] string userName, [FromForm] string password) | ||
{ | ||
var newUser = new IdentityUser { UserName = userName }; | ||
var res = await _userManager.CreateAsync(newUser, password); | ||
|
||
if (res.Succeeded) | ||
ViewData["msg"] = "User registered, now you can log in"; | ||
else | ||
ViewData["msg"] = $"Failed registering user: {res.Errors.First().Description}"; | ||
|
||
return View("Register"); | ||
} | ||
|
||
public async Task<IActionResult> LogOut() | ||
{ | ||
await _signInManager.SignOutAsync(); | ||
return Redirect("/Home/Index"); | ||
} | ||
} | ||
} |
Oops, something went wrong.