Skip to content
代码片段 群组 项目
提交 53ad62a3 编辑于 作者: Pranav K's avatar Pranav K
浏览文件

Remove Precompilation_WorksForViewsUsingDirectoryTraversal

上级 63e17ca6
No related branches found
No related tags found
无相关合并请求
显示
1 个添加247 个删除
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.27130.2036 VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 15.0.26730.03 MinimumVisualStudioVersion = 15.0.26730.03
...@@ -46,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "testapps\ ...@@ -46,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StrongNamedApp", "testapps\
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithParseErrors", "testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj", "{AF647059-B86B-46DD-9559-E1324A39B148}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithParseErrors", "testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj", "{AF647059-B86B-46DD-9559-E1324A39B148}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationUsingRelativePaths", "testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj", "{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{559FBB83-40BC-47AF-A224-312CF8E3629B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithConfigureMvc", "testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj", "{559FBB83-40BC-47AF-A224-312CF8E3629B}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithCustomInputFiles", "testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj", "{8F73A290-BCE1-461A-9970-397FFBFCC902}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithCustomInputFiles", "testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj", "{8F73A290-BCE1-461A-9970-397FFBFCC902}"
...@@ -177,18 +175,6 @@ Global ...@@ -177,18 +175,6 @@ Global
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x64.Build.0 = Release|Any CPU {AF647059-B86B-46DD-9559-E1324A39B148}.Release|x64.Build.0 = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.ActiveCfg = Release|Any CPU {AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.ActiveCfg = Release|Any CPU
{AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.Build.0 = Release|Any CPU {AF647059-B86B-46DD-9559-E1324A39B148}.Release|x86.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x64.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x64.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x86.ActiveCfg = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Debug|x86.Build.0 = Debug|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|Any CPU.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x64.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x64.Build.0 = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x86.ActiveCfg = Release|Any CPU
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8}.Release|x86.Build.0 = Release|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.Build.0 = Debug|Any CPU {559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|x64.ActiveCfg = Debug|Any CPU {559FBB83-40BC-47AF-A224-312CF8E3629B}.Debug|x64.ActiveCfg = Debug|Any CPU
...@@ -310,7 +296,6 @@ Global ...@@ -310,7 +296,6 @@ Global
{7EFC460A-8BAA-4538-8EBE-0B3BB6101E94} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {7EFC460A-8BAA-4538-8EBE-0B3BB6101E94} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{87C6A03D-1655-4D1C-82E5-8F553BF4096D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {87C6A03D-1655-4D1C-82E5-8F553BF4096D} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{AF647059-B86B-46DD-9559-E1324A39B148} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {AF647059-B86B-46DD-9559-E1324A39B148} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{0B512D79-AA53-4C97-91B3-B0F8B2CA16B8} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{559FBB83-40BC-47AF-A224-312CF8E3629B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {559FBB83-40BC-47AF-A224-312CF8E3629B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{8F73A290-BCE1-461A-9970-397FFBFCC902} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {8F73A290-BCE1-461A-9970-397FFBFCC902} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{196EF313-71CB-47A9-A77D-AACAF62881A1} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7} {196EF313-71CB-47A9-A77D-AACAF62881A1} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
......
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
public class ApplicationUsingRelativePathsTest_CoreCLR :
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
{
public ApplicationUsingRelativePathsTest_CoreCLR(
CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[Fact]
public async Task Precompilation_WorksForViewsUsingRelativePath()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response);
}
}
[Fact]
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
}
}
}
}
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
namespace FunctionalTests
{
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
public class ApplicationUsingRelativePathsTest_Desktop :
LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
{
public ApplicationUsingRelativePathsTest_Desktop(
DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup> fixture,
ITestOutputHelper output)
: base(output)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
[ConditionalFact]
public async Task Precompilation_WorksForViewsUsingRelativePath()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response);
}
}
[ConditionalFact]
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
{
using (StartLog(out var loggerFactory))
{
// Arrange
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync(
deployment.ApplicationBaseUri,
loggerFactory.CreateLogger(Fixture.ApplicationName));
// Assert
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
}
}
}
}
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj" /> <ProjectReference Include="..\..\testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj" /> <ProjectReference Include="..\..\testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj" />
<ProjectReference Include="..\..\testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj" /> <ProjectReference Include="..\..\testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj" />
......
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(StandardTestAppTfms)</TargetFrameworks>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
</ItemGroup>
</Project>
using Microsoft.AspNetCore.Mvc;
namespace ApplicationUsingRelativePaths.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View("Views/Home/Index.cshtml");
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
}
}
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
namespace ApplicationUsingRelativePaths
{
public class Program
{
public static void Main(string[] args)
{
var config = new ConfigurationBuilder()
.AddCommandLine(args)
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
.Build();
var host = new WebHostBuilder()
.UseConfiguration(config)
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ApplicationUsingRelativePaths
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
app.UseMvcWithDefaultRoute();
}
}
}
@{
Layout = "../Shared/_Layout.cshtml";
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<p>Use this area to provide additional information.</p>
@{
ViewData["Title"] = "Home Page";
}
@GetType().Assembly.FullName
Hello from Index!
\ No newline at end of file
<!DOCTYPE html>
<html>
<body>
@RenderBody()
</body>
</html>
\ No newline at end of file
@using ApplicationUsingRelativePaths
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "Shared/_Layout.cshtml";
}
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册