Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent javascript injection. #5885

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspnetcore/signalr/get-started/sample/Hubs/ChatHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System;
using System.Threading.Tasks;

namespace SignalRChat.Hubs
namespace SignalRCoreChat.Hubs
{
public class ChatHub : Hub
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace SignalRChat.Pages
namespace SignalRCoreChat.Pages
{
public class AboutModel : PageModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace SignalRChat.Pages
namespace SignalRCoreChat.Pages
{
public class ContactModel : PageModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace SignalRChat.Pages
namespace SignalRCoreChat.Pages
{
public class ErrorModel : PageModel
{
Expand Down
7 changes: 3 additions & 4 deletions aspnetcore/signalr/get-started/sample/SignalRChat.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Remove="Properties\PublishProfiles\ChattR - Web Deploy.pubxml" />
<None Remove="Properties\PublishProfiles\SignalRCoreExample - Web Deploy.pubxml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-*" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-*" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0-preview1-final" />
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview1-final" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-*" />
Expand Down
7 changes: 4 additions & 3 deletions aspnetcore/signalr/get-started/sample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SignalRChat.Hubs;
using SignalRCoreChat.Hubs;

namespace SignalRChat

namespace SignalRCoreChat
{
public class Startup
{
Expand Down Expand Up @@ -34,7 +35,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseExceptionHandler("/Error");
}

app.UseStaticFiles();

app.UseSignalR(routes =>
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/signalr/get-started/sample/wwwroot/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ connection.on('ReceiveMessage', (timestamp, user, message) => {
const encodedUser = user;
const encodedMsg = message;
const listItem = document.createElement('li');
listItem.innerHTML = timestamp + ' <b>' + encodedUser + '</b>: ' + encodedMsg;
listItem.innerText = timestamp + ' ' + encodedUser + ': ' + encodedMsg;
document.getElementById('messages').appendChild(listItem);
});

Expand Down