Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,134
» Latest member: jax9090nnn
» Forum threads: 21,936
» Forum posts: 22,806

Full Statistics

Online Users
There are currently 417 online users.
» 0 Member(s) | 412 Guest(s)
Applebot, Baidu, Bing, Google, Yandex

 
  Forwarded Headers Middleware Updates in .NET Core 3.0 preview 6
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: C#, Visual Basic, & .Net Frameworks - No Replies

Forwarded Headers Middleware Updates in .NET Core 3.0 preview 6

Avatar

With the ASP.NET Core 2.1 release, we included UseHsts and UseHttpRedirection by default. These methods put a site into an infinite loop if deployed to an Azure Linux App Service, Azure Linux virtual machine (VM), or behind any other reverse proxy besides IIS. TLS is terminated by the reverse proxy, and Kestrel isn’t made aware of the correct request scheme.

OAuth and OIDC also fail in this configuration because they generate incorrect redirects. Calls to UseIISIntegration add and configure forwarded headers middleware when running behind IIS, but there’s no matching automatic configuration for Linux (Apache or Nginx integration). The fix for this issue is discussed in more detail in the doc article Forward the scheme for Linux and non-IIS reverse proxies.

Configuration-only Wire-up in Preview 6


With the updates in .NET Core 3 preview 6, you no longer need to call the middleware explicitly, as the host logic has been pre-wired to enable the Forwarded Headers Middleware by default as long as the ASPNETCORE_FORWARDEDHEADERS_ENABLED environment variable has been set to true. Turning on the Forwarded Headers Middleware is as simple as setting the ASPNETCORE_FORWARDEDHEADERS_ENABLED setting in the Azure Portal’s configuration blade for any App Service running on Linux or in a container.

Enabling the Forwarded Headers Middleware via config

Once this setting is set to true, the middleware starts working, and features dependent on Request.IsHttps resulting to true begin to function as expected.

Resolving the issue with ASP.NET Core 2.x Apps Today


If you’re currently building an ASP.NET Core 2.x app and want to run it on App Service for Linux now, there’s a workaround that will be future-proof when the updates come out for 3.0.

To forward the scheme from the proxy in non-IIS scenarios, add and configure Forwarded Headers Middleware. In Startup.cs, use the following code:

// using Microsoft.AspNetCore.HttpOverrides; public void ConfigureServices(IServiceCollection services)
{ if (string.Equals( Environment.GetEnvironmentVariable("ASPNETCORE_FORWARDEDHEADERS_ENABLED"), "true", StringComparison.OrdinalIgnoreCase)) { services.Configure<forwardedheadersoptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; // Only loopback proxies are allowed by default. // Clear that restriction because forwarders are enabled by explicit // configuration. options.KnownNetworks.Clear(); options.KnownProxies.Clear(); }); }
} public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ app.UseForwardedHeaders();
}

If you enable your ASP.NET Core 2.x apps with this workaround today, when you’re ready to upgrade to 3.0, you’ll already have the right configuration setting in place.

Base Image Update


The base images used by the App Service team to streamline the creation of ASP.NET Core apps will soon be updated so that the ASPNETCORE_FORWARDEDHEADERS_ENABLED environment variable will be set to true. Once they’re updated, you won’t even need to explicitly set the environment variable; it’ll be enabled by default.

Try it Out


If you’re new to building ASP.NET Core apps using containers, the App Service options for Linux and Container-based hosting offer a great place to get started. The docs are loaded with guidance and examples, from how to Run a .NET Core app in App Service on Linux to accessing a SQL Server Database from an ASP.NET Core app running in App Service Linux.

Avatar
Brady Gaster

Senior Program Manager, ASP.NET Core

Follow    



https://www.sickgaming.net/blog/2019/06/...preview-6/

Print this item

  AppleInsider - Crime blotter: Man charged in car crash death of Apple employee
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: Apples Mac and OS X - No Replies

Crime blotter: Man charged in car crash death of Apple employee

Man charged in car crash death of Apple employee, cruise worker steals couple’s iPhone, and more from the Apple crime blotter.

The Bridge Street Apple Store in Huntsville

The Bridge Street Apple Store in Huntsville

The latest in a continuing AppleInsider series, exploring the world of Apple-related crime.

Man arrested for striking, killing Apple engineer


A 32-year-old man was arrested this week after police say he was driving the stolen car that struck and killed a woman who worked as a technical program manager for Apple. According to People, 28-year-old Carol Major died after she was struck by the stolen car, which had run a red light and broadsided the Lyft car she was riding in, in Santa Clara, Calif. The driver, 32-year-old Claudio Perez, has been charged with murder, driving under the influence of alcohol/drugs while causing an injury, evading a police officer and auto theft.

Traffic stop leads to arrest of $2 million Best Buy theft ring


Police in Texas last month pulled over a car with “fictitious” plates, and in it they found $20,000 in stolen iPhones that they report are connected to a multi-state Best Buy theft ring. According to 12 News Now, the overall ring stole more than $2 million worth of iPhones and MacBooks. Six men from Houston, police say, carried out the ring. A separate bust that notched 27 MacBooks, per The Sun Herald, concerned the same ring.

Cruise worker got couple to give up iPhone passcode


A couple was playing a game of “Mr. and Mrs.” on stage on a cruise when they revealed the passcode to the husband’s missing iPhone 7 Plus to a cruise ship worker. Per iNews, when the couple got home from the cruise and synched the man’s new phone with his iCloud account, they realized the cruise ship worker had been using the phone. He was later fired by the cruise ship company.

Thieves used stolen credit card for $5,000 Apple Store spree


An Alabama woman last week had her wallet stolen while eating in a restaurant– and the thieves used her credit card to spend $5,000 at a nearby Apple Store. Per WAFF, the alleged thieves were spotted on camera while at the Bridge Street Town Centre Apple Store in Huntsville.

iPhone, MacBook data helped catch accused “fake news” entrepreneur


A Pennsylvania man who is accused of running a “fake news” website allegedly forged an email that he used as the basis of a news story- and prosecutors say iPhone and MacBook data seized from his home “contained overwhelming evidence” that he created the email himself. According to The Philadelphia Inquirer, Nikolaos “Nik the Hat” Hatziefstathiou is accused of doctoring an email to make it appear as though an employee of a county parole board had authored a racist email. But prosecutors say the data shows the email was not genuine and created by the accused. Hatziefstathiou, who has been charged with tampering with public records, forgery, identity theft, will be arraigned next month.

iPhone stolen out of woman’s hand in Philadelphia


A 27-year-old woman had an iPhone XS stolen right out of her hand while on a street in Center City Philadelphia in mid-August. Per 6ABC, the thief grabbed the phone and immediately took off for a nearby subway entrance.

Accused package thief spent $4,000 at Apple Store


Police are searching for an Oregon man who they say stole a credit card from a package, and used that credit card to spend $4,100at a nearby Apple Store. Per KATU, the man had been seen following UPS and FedEx trucks, while driving a Mercedes M-Class.

Mac minis, other electronics stolen from school


More than $30,000 in electronics, including an iPad and 16 Mac mini computers were stolen from the Germantown Friends School in Philadelphia. Per The Philadelphia Inquirer, the thefts took place over two different nights the first week of August. Teenagers, who were caught on police surveillance video, are suspected of the crime.

Have an Apple-related crime story? Email AppleInsider and tell us about it.



https://www.sickgaming.net/blog/2019/09/...-employee/

Print this item

  Microsoft - The holidays come early at IFA 2019
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: Windows - No Replies

The holidays come early at IFA 2019

Nicole Dezen at IFA 2019

This week I had the pleasure of being in Berlin, Germany, for IFA 2019 to meet with our PC and IoT ecosystem partners. This is always an exciting time for me because I get to see all the new PCs and intelligent edge devices coming this holiday season. Over the last week, our partners Acer, ASUS, Dell, Lenovo and Razer have announced new Windows 10 PCs that both consumer and commercial customers are sure to want.

Modern PCs look different because they are different. They have better performance, innovative designs and new experiences. According to Microsoft research, people are happier when they get a modern PC. We have a lot of modern PCs in market already from all our device partners, and it’s great to see these benefits continuing to come to life in recently announced devices from our partners.

Better performance

Performance starts with a modern computer with solid-state drives (SSDs). SSDs make the computers fast, thin and light. Performance also considers how long the battery lasts and what processor is used. All these elements are critical for customers who want to use their device on the go and run multiple workloads at once. Today’s modern PCs are at least two times faster and can stay unplugged on average of 32% longer compared to HDD models. Intel’s recently announced 10th Generation Intel Core processors enhance the experience for many of these new devices with AI, Thunderbolt 3 and Intel Wi-Fi 6 technologies, all of which increase speed of connectivity.

A great example is the new Dell XPS 13 now with an Intel 10th Generation processor. Whether bingeing a video series or working on the go, this device delivers performance gains needed for compute-intensive, demanding, multi-thread workloads – while still efficiently displaying beautiful 4K content.

Dell XPS 13

The latest Lenovo ThinkPad X1 Carbon laptops are great examples of devices engineered for an on-the-go workforce that needs higher performance to improve their workday productivity and security. These devices are optimized for long battery life and Wi-Fi 6 connectivity.

Lenovo ThinkPad X1 Carbon laptop

Razer announced the new Razer Blade Stealth 13 – the first gaming laptop with NVIDIA’s GeForce GTX 1650. Powered by Intel’s new 10th Generation processor, the new Razer Blade Stealth 13 delivers true gaming performance packed into an amazingly thin 15mm chassis weighing only 1.3 kgs.

Razer Blade Stealth 13

Innovative designs

Being fast and powerful used to come at the expense of a beautiful device, but not anymore. Windows 10 PCs are designed to be shown off with touches like metallic finishes and backlit keyboards. Choice of form factors help you work the way you want with 2-in-1 convertibles, detachables and ultraslim designs.

The new ASUS Republic of Gamers demonstrates this attention to design. By offering a new Glacier Blue hue for select Zephyrus and Strix family laptops, the company is reimagining the look and feel of gaming machines for a widening audience of gamers who are also streamers and creative professionals who want more than a black machine.

Strix laptop

Great design also comes with devices that are thin and light. The Acer Swift 5*, a super light 14-inch notebook that is 15.95 mm thin, only weighs 990 grams and comes with a new discrete NVIDIA GeForce MX250 graphics option for high-powered gaming.

Acer Swift 5

New experiences

Finally, we want customers to have the best experiences with their hardware and software, and that begins with the applications and services that come with a Windows 10 PC. This includes multiple ways to interact, with ink and pen, voice and touch, and compatibility with other devices and applications. It also includes top-grade security with Windows Hello and the on-the-go productivity benefits in Office 365 enabled by the cloud. When it comes down to it, Windows 10 PCs help you achieve more.

With a modern PC you get speed, security, durability and great design. While there is a lot of focus on PCs at IFA, we also see a lot of innovation from our partners around the Intelligent Cloud and Intelligent Edge.

By 2020 analysts estimate that 20 billion devices will be connected to the cloud, and Microsoft and our ecosystem of partners offer a unique value proposition because our Intelligent Cloud and Intelligent Edge solutions are extra smart, secure and agile. For example, we have the Smart Home solution from digitalSTROM in our Microsoft booth where you can experience different ways to operate your Smart Home; e.g., order a cup of coffee from a robot or start the coffee machine with just a smile via a 3D Intel RealSense camera.

From the latest in modern, powerful Windows 10 PCs to cloud-connected services, I am constantly amazed by the innovative ways our partners are building on our platforms to deliver rich experiences to customers.  I think it’s going to be a great holiday season for Microsoft, our partners and our customers.

Check back on the Windows Blog for more updates in the coming months.

*Based on Acer’s internal survey as of August 29, 2019 of competing clamshell laptop designs available on the market, running Windows OS or OSX.



https://www.sickgaming.net/blog/2019/09/...-ifa-2019/

Print this item

  Huawei To Help Create Nation’s First Open-Source Foundation
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: Linux, FreeBSD, and Unix types - No Replies

Huawei To Help Create Nation’s First Open-Source Foundation

Huawei Technologies Co said it plans to partner with other companies to set up China’s first open-source software foundation, which is expected to begin to operate in a month or two to expand the nation’s software community. The plan for the software foundation came after GitHub, the world’s largest host of source code, prevented in July users in Iran and other nations sanctioned by the United States government from accessing portions of its service. The incident highlights increasing geopolitical interference with global open-source tech communities, which are supposed to be fair and open to all, analysts said. (Source: China.org)

Click Here!



https://www.sickgaming.net/blog/2019/08/...oundation/

Print this item

  Fedora - Getting Started with Go on Fedora
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: Linux, FreeBSD, and Unix types - No Replies

Getting Started with Go on Fedora

The Go programming language was first publicly announced in 2009, since then the language has become widely adopted. In particular Go has become a reference in the world of cloud infrastructure with big projects like Kubernetes, OpenShift or Terraform for example.

Some of the main reasons for Go’s increasing popularity are the performances, the ease to write fast concurrent application, the simplicity of the language and fast compilation time. So let’s see how to get started with Go on Fedora.

Install Go in Fedora


Fedora provides an easy way to install the Go programming language via the official repository.

$ sudo dnf install -y golang
$ go version
go version go1.12.7 linux/amd64

Now that Go is installed, let’s write a simple program, compile it and execute it.

First program in Go


Let’s write the traditional “Hello, World!” program in Go. First create a main.go file and type or copy the following.

package main import "fmt" func main() { fmt.Println("Hello, World!")
}

Running this program is quite simple.

$ go run main.go
Hello, World!

This will build a binary from main.go in a temporary directory, execute the binary, then delete the temporary directory. This command is really great to quickly run the program during development and it also highlights the speed of Go compilation.

Building an executable of the program is as simple as running it.

$ go build main.go
$ ./main
Hello, World!

Using Go modules


Go 1.11 and 1.12 introduce preliminary support for modules. Modules are a solution to manage application dependencies. This solution is based on 2 files go.mod and go.sum used to explicitly define the version of the dependencies.

To show how to use modules, let’s add a dependency to the hello world program.

Before changing the code, the module needs to be initialized.

$ go mod init helloworld
go: creating new go.mod: module helloworld
$ ls
go.mod main main.go

Next modify the main.go file as follow.

package main import "github.com/fatih/color" func main () { color.Blue("Hello, World!")
}

In the modified main.go, instead of using the standard library “fmt” to print the “Hello, World!”. The application uses an external library which makes it easy to print text in color.

Let’s run this version of the application.

$ go run main.go
Hello, World!

Now that the application is depending on the github.com/fatih/color library, it needs to download all the dependencies before compiling it. The list of dependencies is then added to go.mod and the exact version and commit hash of these dependencies is recorded in go.sum.



https://www.sickgaming.net/blog/2019/08/...on-fedora/

Print this item

  News - Iron Galaxy Helped Bring Overwatch To Switch, Nintendo Version Runs At 30fps
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: Nintendo Discussion - No Replies

Iron Galaxy Helped Bring Overwatch To Switch, Nintendo Version Runs At 30fps


At the very beginning of the most recent Nintendo Direct, it was revealed the popular team-based shooter Overwatch would be coming to the Switch. Since then, Blizzard has been answering many questions about this particular version of the game and if it will support features like cross-play and cross-progression.

If you’ve been wondering how the Nintendo release will hold up in terms of performance, principal game producer Wes Yanagi revealed what Switch players could expect during a recent interview with Eurogamer:

So really what we wanted to do when we started this whole thing was to really deliver on that authentic Overwatch experience. Our goal was making sure it could run smoothly and look the way that we’re happy with. So, it runs at 30fps, docked at 900p and un-docked at 720p, and it runs really smoothly. I think when you play it, and you get your hands on it, you just go, yeah I’m playing Overwatch.

Digital Foundry was also quick to point out the Hi-Rez team-based shooter Paladins runs at 60fps on Switch. And on Xbox One and PlayStation 4, Overwatch runs at 60fps and has a resolution of 1080p.

Over on Twitter, Blizzard communications manager Nazih Fares was asked the same question about the frame rate and resolution of the Switch version and reiterated the above information. When asked who had developed the Overwatch port for Switch, he confirmed Blizzard had “worked closely” with Iron Galaxy.

Iron Galaxy is the same port specialist that helped Blizzard release Diablo III: Eternal Collection on the Switch, and prior to this, worked on The Elder Scrolls V: Skyrim for Nintendo’s hybrid platform.

Are you glad to hear Iron Galaxy is involved? What do you think of the frame rate being locked at 30fps? Leave a comment down below.



https://www.sickgaming.net/blog/2019/09/...-at-30fps/

Print this item

  News - Sony Boss Talks Spider-Man's Marvel Movie Future
Posted by: xSicKxBot - 09-09-2019, 05:02 AM - Forum: Lounge - No Replies

Sony Boss Talks Spider-Man's Marvel Movie Future

It's been a tumultuous month for Peter Parker. After the deal brokered between Sony Pictures and Marvel Studios allowing the character to appear in the Marvel Cinematic Universe collapsed, speculation has been swirling from all sides about what Spider-Man's live-action future may look like. Many fans have been holding out hope that the two studios will reach some sort of agreement that will allow him to continue appearing in the MCU--but, unfortunately, that does not seem to be the case.

As reported by Variety, Sony Pictures chairman and CEO Tony Vinciquerra did not mince words when questioned about the ability for a compromise to be reached. "For the moment," Vinciquerra said, "the door is closed."

However final these statements may seem, Vinciquerra also insisted that there is no "ill will" between Sony and Marvel over the deal and, cryptically, mentioned that it's "a long life," implying that while things are decidedly off the table right now, the future is still full of potential.

Vinciquerra went on to nod to Sony's upcoming Spider-Man centric shared universe outside of the MCU, which kicked off with Venom last year. "Spider-Man was fine before the event movies, did better with the event movies, and now that we have our own universe, he will play off the other characters as well," Vinciquerra said. "I think we're pretty capable of doing what we have to do here."

So, if there's a bright side to all of this, it looks like the possibility of Tom Holland's Peter Parker encountering Tom Hardy's Eddie Brock on the big screen might actually be on the table. What this means for the Spider-Man plot lines left dangling in the MCU in the wake of Spider-Man: Far From Home and Avengers: Endgame, however, is really anybody's guess.

As for the (somewhat playful, somewhat serious) speculation about Disney's potential acquisition of Sony to resolve the issue, Vinciquerra stated plainly that "Sony Pictures is not for sale."

Marvel boss Kevin Feige also recently discussed the potential end of Spider-Man in the MCU, saying, "It was never meant to last forever."


https://www.gamespot.com/articles/sony-b...0-6469678/

Print this item

  Unreal Engine Marketplace 5th Anniversary Sale
Posted by: xSicKxBot - 09-08-2019, 08:55 PM - Forum: Game Development - No Replies

Unreal Engine Marketplace 5th Anniversary Sale

Epic Games have just announced an Unreal Engine marketplace sale running from August 27th through September 3rd, 2019.  Details from the Unreal Engine blog:

It’s officially the 5-year anniversary of the Unreal Engine Marketplace!
Celebrate with us by saving up to 50% on select products. Over 4,000 fantastic products have been discounted, ranging from environments, Blueprints, props,characters and beyond!

The sale runs now through September 3 at 11:59 PM EDT.

Thank you to all the amazing Marketplace creators who have contributed to the Unreal development community over the last five years by offering outstanding content and support.

Don’t forget to check out the currently free offerings for August if you haven’t already.  An asset of interest to many developers was the CCG Toolkit, previously featured for free, which is currently on sale for 50% off in the sale if you missed it before.

GameDev News




https://www.sickgaming.net/blog/2019/08/...sary-sale/

Print this item

  Mobile - Star Traders Frontiers Upcoming Update Changes Everything
Posted by: xSicKxBot - 09-08-2019, 08:55 PM - Forum: New Game Releases - No Replies

Star Traders Frontiers Upcoming Update Changes Everything

By Joe Robinson 27 Aug 2019

It’s no secret, we’re big fans of Star Traders: Frontiers here at Pocket Tactics. The open-world sci-fi RPG does a lot of things right, from its free-form character customisation, to the blank-slate that is your ship and the path you can choose out amongst the stars.

Beyond that though, it’s also a pretty respectable beacon of not only premium mobile games, but game development in general. Frontiers occupies a ‘middle-ground’ in terms of pricing, but Cory and Andy Trese (known as the Trese Brothers) are continually adding to the game. From micro-content drops, to new ship classes and now – a brand new late-game Era.

STF Era 6 3

This ‘Sixth’ Era – known as either The Era of Dissension or The Era of Consolidation depending on your choices, essentially brings all of the change and evolution the game world will have gone through to a head. It advances several of the main galactic story-lines that chug away in the background. This game-defining threads, like all content in STF, can either be actively engaged with or completely ignored by the player, but they will happen regardless and Era 6 is no exception.

I had a quick chat with the Trese Brothers to go over what’s coming in the new update (which already hit PC today). While every story ‘era’ has a prolonged effect on the game’s underlying simulation, Era 6 specifically is coming with a host of bespoke rules and tweaks that will define how your game will play out:

  • Added new story vignette to introduce the Era, “Buried Demons” with Thulun Intelligence Officer.
  • All new simulation rules, Rumors, Conflicts, and Contact actions/mutations.
  • Added 2 Era-specific Rumors as Coalition power shifts.
  • Added 4 Era-specific special cargo rules for Merchants, Smugglers and Pirates.
  • Added 6 Era-specific Contact creation rules to seed the Era new blood.
  • Added new Era-driven ship encounter and mechanics.
  • Added 8 new ship weapons released by the Era progressions — gear up for advanced warfare!
  • Added 3 new major story characters who can have wide impact.
  • Added 3 new specialist ship components available through story choices and rewards.
  • Added new unique crew equipment available through story choices and rewards.

Not only that, but a brand-new job type is also coming to the game – the Bodyguard. This is STF’s 34th job, and is a defensive-focused fighter that can dual wield pistols AND Blades.

STF Era 6

This new update will be coming to both iOS and Android shortly – mobile patches usually trail a bit behind the PC updates due to the approval process, but this is just the beginning. Era six marks the start of the Version 2.6.x build, which according the road-map includes a 7th era and a new Xeno species.

If you’ve been looking for an excuse to jump back into Frontiers, or need a reason to try it out for the first time, then this latest update should do the trick. There aren’t many studios who are so relentless in their support for a game after it releases (for free, no less) and if you have any interest in RPGS where you’re the captain of your own ship, then you need to check this out.



https://www.sickgaming.net/blog/2019/08/...verything/

Print this item

  ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 6
Posted by: xSicKxBot - 09-08-2019, 08:55 PM - Forum: C#, Visual Basic, & .Net Frameworks - No Replies

ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 6

Daniel Roth

Daniel

.NET Core 3.0 Preview 6 is now available and it includes a bunch of new updates to ASP.NET Core and Blazor.

Here’s the list of what’s new in this preview:

  • New Razor features: @attribute, @code, @key, @namespace, markup in @functions
  • Blazor directive attributes
  • Authentication & authorization support for Blazor apps
  • Static assets in Razor class libraries
  • Json.NET no longer referenced in project templates
  • Certificate and Kerberos Authentication
  • SignalR Auto-reconnect
  • Managed gRPC Client
  • gRPC Client Factory
  • gRPC Interceptors

Please see the release notes for additional details and known issues.

Get started


To get started with ASP.NET Core in .NET Core 3.0 Preview 6 install the .NET Core 3.0 Preview 6 SDK

If you’re on Windows using Visual Studio, you also need to install the latest preview of Visual Studio 2019.

For the latest client-side Blazor templates also install the latest Blazor extension from the Visual Studio Marketplace.

Upgrade an existing project


To upgrade an existing an ASP.NET Core app to .NET Core 3.0 Preview 6, follow the migrations steps in the ASP.NET Core docs.

Please also see the full list of breaking changes in ASP.NET Core 3.0.

To upgrade an existing ASP.NET Core 3.0 Preview 5 project to Preview 6:

  • Update Microsoft.AspNetCore.* package references to 3.0.0-preview6.19307.2
  • In Blazor apps:
    • Rename @functions to @code
    • Update Blazor specific attributes and event handlers to use the new directive attribute syntax (see below)
    • Remove any call to app.UseBlazor<TStartup>() and instead add a call to app.UseClientSideBlazorFiles<TStartup>() before the call to app.UseRouting(). Also add a call to endpoints.MapFallbackToClientSideBlazor<TStartup>("index.html") in the call to app.UseEndpoints().

Before

app.UseRouting(); app.UseEndpoints(endpoints =>
{ endpoints.MapDefaultControllerRoute();
}); app.UseBlazor<Client.Startup>();

After

app.UseClientSideBlazorFiles<Client.Startup>(); app.UseRouting(); app.UseEndpoints(endpoints =>
{ endpoints.MapDefaultControllerRoute(); endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html");
});

New Razor features


We’ve added support for the following new Razor language features in this release.

@attribute


The new @attribute directive adds the specified attribute to the generated class.

@attribute [Authorize]

@code


The new @code directive is used in .razor files (not supported in .cshtml files) to specify a code block to add to the generated class as additional members. It’s equivalent to @functions, but now with a better name.

@code { int currentCount = 0; void IncrementCount() { currentCount++; }
}

@key


The new @key directive attribute is used in .razor files to specify a value (any object or unique identifier) that the Blazor diffing algorithm can use to preserve elements or components in a list.

@foreach (var flight in Flights) { }

To understand why this feature is needed, consider rendering a list of cards with flight details without this feature:

@foreach (var flight in Flights) { }

If you add a new flight into the middle of the Flights list the existing DetailsCard instances should remain unaffected and one new DetailsCard should be inserted into the rendered output.

To visualize this, if Flights previously contained [F0, F1, F2], then this is the before state:

  • DetailsCard0, with Flight=F0
  • DetailsCard1, with Flight=F1
  • DetailsCard2, with Flight=F2

… and this is the desired after state, given we insert a new item FNew at index 1:

  • DetailsCard0, with Flight=F0
  • DetailsCardNew, with Flight=FNew
  • DetailsCard1, with Flight=F1
  • DetailsCard2, with Flight=F2

However, the actual after state this:

  • DetailsCard0, with Flight=F0
  • DetailsCard1, with Flight=FNew
  • DetailsCard2, with Flight=F1
  • DetailsCardNew, with Flight=F2

The system has no way to know that DetailsCard2 or DetailsCard3 should preserve their associations with their older Flight instances, so it just re-associates them with whatever Flight matches their position in the list. As a result, DetailsCard1 and DetailsCard2 rebuild themselves completely using new data, which is wasteful and sometimes even leads to user-visible problems (e.g., input focus is unexpectedly lost).

By adding keys using @key the diffing algorithm can associate the old and new elements or components.

@namespace


Specifies the namespace for the generated class or the namespace prefix when used in an _Imports.razor file. The @namespace directive works today in pages and views (.cshtml) apps, but is now it is also supported with components (.razor).

@namespace MyNamespace

Markup in @functions and local functions


In views and pages (.cshtml files) you can now add markup inside of methods in the @functions block and in local functions.

@{ GreetPerson(person); } @functions { void GreetPerson(Person person) { <p>Hello, <em>@person.Name!</em></p> }
}

Blazor directive attributes


Blazor uses a variety of attributes for influencing how components get compiled (e.g. ref, bind, event handlers, etc.). These attributes have been added organically to Blazor over time and use different syntaxes. In this Blazor release we’ve standardized on a common syntax for directive attributes. This makes the Razor syntax used by Blazor more consistent and predictable. It also paves the way for future extensibility.

Directive attributes all follow the following syntax where the values in parenthesis are optional:

@directive(-suffix(:name))(="value")

Some valid examples:

<!-- directive -->
...
<!-- directive with key/value arg-->
...
<!-- directive with suffix -->
<!-- directive with suffix and key/value arg-->

All of the Blazor built-in directive attributes have been updated to use this new syntax as described below.

Event handlers

Specifying event handlers in Blazor now uses the new directive attribute syntax instead of the normal HTML syntax. The syntax is similar to the HTML syntax, but now with a leading @ character. This makes C# event handlers distinct from JS event handlers.

<button @onclick="@Clicked">Click me!</button>

When specifying a delegate for C# event handler the @ prefix is currently still required on the attribute value, but we expect to remove this requirement in a future update.

In the future we also expect to use the directive attribute syntax to support additional features for event handlers. For example, stopping event propagation will likely look something like this (not implemented yet, but it gives you an idea of scenarios now enabled by directive attributes):

<button @onclick="Clicked" @onclick:stopPropagation>Click me!</button>

Bind

<input @bind="myValue">...</input>
<input @bind="myValue" @bind:format="mm/dd">...</input>
<MyButton @bind-Value="myValue">...</MyButton>

Key

...

Ref

<button @ref="myButton">...</button>

Authentication & authorization support for Blazor apps


Blazor now has built-in support for handling authentication and authorization. The server-side Blazor template now supports options for enabling all of the standard authentication configurations using ASP.NET Core Identity, Azure AD, and Azure AD B2C. We haven’t updated the Blazor WebAssembly templates to support these options yet, but we plan to do so after .NET Core 3.0 has shipped.

To create a new Blazor app with authentication enabled:

  1. Create a new Blazor (server-side) project and select the link to change the authentication configuration. For example, select “Individual User Accounts” and “Store user accounts in-app” to use Blazor with ASP.NET Core Identity:

    Blazor authentication

  2. Run the app. The app includes links in the top row for registering as a new user and logging in.

    Blazor authentication running

  3. Select the Register link to register a new user.

    Blazor authentication register

  4. Select “Apply Migrations” to apply the ASP.NET Core Identity migrations to the database.

    Blazor authentication apply migrations

  5. You should now be logged in.

    Blazor authentication logged in

  6. Select your user name to edit your user profile.

    Blazor authentication edit profile

In the Blazor app, authentication and authorization are configured in the Startup class using the standard ASP.NET Core middleware.

app.UseRouting(); app.UseAuthentication();
app.UseAuthorization(); app.UseEndpoints(endpoints =>
{ endpoints.MapControllers(); endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host");
});

When using ASP.NET Core Identity all of the identity related UI concerns are handled by the framework provided default identity UI.

services.AddDefaultIdentity<IdentityUser>() .AddEntityFrameworkStores<ApplicationDbContext>();

The authentication related links in top row of the app are rendered using the new built-in AuthorizeView component, which displays different content depending on the authentication state.

LoginDisplay.razor

<AuthorizeView> <Authorized> <a href="Identity/Account/Manage">Hello, @context.User.Identity.Name!</a> <a href="Identity/Account/LogOut">Log out</a> </Authorized> <NotAuthorized> <a href="Identity/Account/Register">Register</a> <a href="Identity/Account/Login">Log in</a> </NotAuthorized>
</AuthorizeView>

The AuthorizeView component will only display its child content when the user is authorized. Alternatively, the AuthorizeView takes parameters for specifying different templates when the user is Authorized, NotAuthorized, or Authorizing. The current authentication state is passed to these templates through the implicit context parameter. You can also specify specific roles or an authorization policy on the AuthorizeView that the user must satisfy to see the authorized view.

To authorize access to specific pages in a Blazor app, use the normal [Authorize] attribute. You can apply the [Authorize] attribute to a component using the new @attribute directive.

@using Microsoft.AspNetCore.Authorization
@attribute [Authorize]
@page "/fetchdata"

To specify what content to display on a page that requires authorization when the user isn’t authorized or is still in the processing of authorizing, use the NotAuthorizedContent and AuthorizingContent parameters on the Router component. These Router parameters are only support in client-side Blazor for this release, but they will be enabled for server-side Blazor in a future update.

The new AuthenticationStateProvider service make the authentication state available to Blazor apps in a uniform way whether they run on the server or client-side in the browser. In server-side Blazor apps the AuthenticationStateProvider surfaces the user from the HttpContext that established the connection to the server. Client-side Blazor apps can configure a custom AuthenticationStateProvider as appropriate for that application. For example, it might retrieve the current user information by querying an endpoint on the server.

The authentication state is made available to the app as a cascading value (Task<AuthenticationState>) using the CascadingAuthenticationState component. This cascading value is then used by the AuthorizeView and Router components to authorize access to specific parts of the UI.

App.razor

<CascadingAuthenticationState> <Router AppAssembly="typeof(Startup).Assembly"> <NotFoundContent> <p>Sorry, there's nothing at this address.</p> </NotFoundContent> </Router>
</CascadingAuthenticationState>

Static assets in Razor class libraries


Razor class libraries can now include static assets like JavaScript, CSS, and images. These static assets can then be included in ASP.NET Core apps by referencing the Razor class library project or via a package reference.

To include static assets in a Razor class library add a wwwroot folder to the Razor class library and include any required files in that folder.

When a Razor class library with static assets is referenced either as a project reference or as a package, the static assets from the library are made available to the app under the path prefix _content/{LIBRARY NAME}/. The static assets stay in their original folders and any changes to the content of static assets in the Razor class libraries are reflected in the app without rebuilding.

When the app is published, the companion assets from all referenced Razor class libraries are copied into the wwwroot folder of the published app under the same prefix.

To try out using static assets from a Razor class library:

  1. Create a default ASP.NET Core Web App.

    dotnet new webapp -o WebApp1
  2. Create a Razor class library and reference it from the web app.

    dotnet new razorclasslib -o RazorLib1
    dotnet add WebApp1 reference RazorLib1
  3. Add a wwwroot folder to the Razor class library and include a JavaScript file that logs a simple message to the console.

    cd RazorLib1
    mkdir wwwroot

    hello.js

    console.log("Hello from RazorLib1!");
  4. Reference the script file from Index.cshtml in the web app.

    http://_content/RazorLib1/hello.js
  5. Run the app and look for the output in the browser console.

    Hello from RazorLib1!
    

Projects now use System.Text.Json by default


New ASP.NET Core projects will now use System.Text.Json for JSON handling by default. In this release we removed Json.NET (Newtonsoft.Json) from the project templates. To enable support for using Json.NET, add the Microsoft.AspNetCore.Mvc.NewtonsoftJson package to your project and add a call to AddNewtonsoftJson() following code in your Startup.ConfigureServices method. For example:

services.AddMvc() .AddNewtonsoftJson();

Certificate and Kerberos authentication


Preview 6 brings Certificate and Kerberos authentication to ASP.NET Core.

Certificate authentication requires you to configure your server to accept certificates, and then add the authentication middleware in Startup.Configure and the certificate authentication service in Startup.ConfigureServices.

public void ConfigureServices(IServiceCollection services)
{ services.AddAuthentication( CertificateAuthenticationDefaults.AuthenticationScheme) .AddCertificate(); // All the other service configuration.
} public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{ app.UseAuthentication(); // All the other app configuration.
}

Options for certificate authentication include the ability to accept self-signed certificates, check for certificate revocation, and check that the proffered certificate has the right usage flags in it. A default user principal is constructed from the certificate properties, with an event that enables you to supplement or replace the principal. All the options, and instructions on how to configure common hosts for certificate authentication can be found in the documentation.

We’ve also extended “Windows Authentication” onto Linux and macOS. Previously this authentication type was limited to IIS and HttpSys, but now Kestrel has the ability to use Negotiate, Kerberos, and NTLM on Windows, Linux, and macOS for Windows domain joined hosts by using the Microsoft.AspNetCore.Authentication.Negotiate nuget package. As with the other authentication services you configure authentication app wide, then configure the service:

public void ConfigureServices(IServiceCollection services)
{ services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) .AddNegotiate();
} public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{ app.UseAuthentication(); // All the other app configuration.
}

Your host must be configured correctly. Windows hosts must have SPNs added to the user account hosting the application. Linux and macOS machines must be joined to the domain, then SPNs must be created for the web process, as well as keytab files generated and configured on the host machine. Full instructions are given in the documentation.

SignalR Auto-reconnect


This preview release, available now via npm install @aspnet/signalr@next and in the .NET Core SignalR Client, includes a new automatic reconnection feature. With this release we’ve added the withAutomaticReconnect() method to the HubConnectionBuilder. By default, the client will try to reconnect immediately and after 2, 10, and 30 seconds. Enlisting in automatic reconnect is opt-in, but simple via this new method.

const connection = new signalR.HubConnectionBuilder() .withUrl("/chatHub") .withAutomaticReconnect() .build();

By passing an array of millisecond-based durations to the method, you can be very granular about how your reconnection attempts occur over time.

.withAutomaticReconnect([0, 3000, 5000, 10000, 15000, 30000])
//.withAutomaticReconnect([0, 2000, 10000, 30000]) yields the default behavior

Or you can pass in an implementation of a custom reconnect policy that gives you full control.

If the reconnection fails after the 30-second point (or whatever you’ve set as your maximum), the client presumes the connection is offline and stops trying to reconnect. During these reconnection attempts you’ll want to update your application UI to provide cues to the user that the reconnection is being attempted.

Reconnection Event Handlers


To make this easier, we’ve expanded the SignalR client API to include onreconnecting and onreconnected event handlers. The first of these handlers, onreconnecting, gives developers a good opportunity to disable UI or to let users know the app is offline.

connection.onreconnecting((error) => { const status = `Connection lost due to error "${error}". Reconnecting.`; document.getElementById("messageInput").disabled = true; document.getElementById("sendButton").disabled = true; document.getElementById("connectionStatus").innerText = status;
});

Likewise, the onreconnected handler gives developers an opportunity to update the UI once the connection is reestablished.

connection.onreconnected((connectionId) => { const status = `Connection reestablished. Connected.`; document.getElementById("messageInput").disabled = false; document.getElementById("sendButton").disabled = false; document.getElementById("connectionStatus").innerText = status;
});

Learn more about customizing and handling reconnection


Automatic reconnect has been partially documented already in the preview release. Check out the deeper docs on the topic, with more examples and details on usage, at https://aka.ms/signalr/auto-reconnect.

Managed gRPC Client


In prior previews, we relied on the Grpc.Core library for client support. The addition of HTTP/2 support in HttpClient in this preview has allowed us to introduce a fully managed gRPC client.

To begin using the new client, add a package reference to Grpc.Net.Client and then you can create a new client.

var httpClient = new HttpClient() { BaseAddress = new Uri("https://localhost:5001") };
var client = GrpcClient.Create<GreeterClient>(httpClient);

gRPC Client Factory


Building on the opinionated pattern we introduced in HttpClientFactory, we’ve added a gRPC client factory for creating gRPC client instances in your project. There are two flavors of the factory that we’ve added: Grpc.Net.ClientFactory and Grpc.AspNetCore.Server.ClientFactory.

The Grpc.Net.ClientFactory is designed for use in non-ASP.NET app models (such as Worker Services) that still use the Microsoft.Extensions.* primitives without a dependency on ASP.NET Core.

In applications that perform service-to-service communication, we often observe that most servers are also clients that consume other services. In these scenarios, we recommend the use of Grpc.AspNetCore.Server.ClientFactory which features automatic propagation of gRPC deadlines and cancellation tokens.

To use the client factory, add the appropriate package reference to your project (Grpc.AspNetCore.Server.Factory or Grpc.Net.ClientFactory) before adding the following code to ConfigureServices().

services .AddGrpcClient<GreeterClient>(options => { options.BaseAddress = new Uri("https://localhost:5001"); });

gRPC Interceptors


gRPC exposes a mechanism to intercept RPC invocations on both the client and the server. Interceptors can be used in conjunction with existing HTTP middleware. Unlike HTTP middleware, interceptors give you access to actual request/response objects before serialization (on the client) and after deserialization (on the server) and vice versa for the response. All middlewares run before interceptors on the request side and vice versa on the response side.

Client interceptors


When used in conjunction with the client factory, you can add a client interceptor as shown below.

services .AddGrpcClient<GreeterClient>(options => { options.BaseAddress = new Uri("https://localhost:5001"); }) .AddInterceptor<CallbackInterceptor>();

Server interceptors


Server interceptors can be registered in ConfigureServices() as shown below.

services .AddGrpc(options => { // This registers a global interceptor options.Interceptors.Add<MaxStreamingRequestTimeoutInterceptor>(TimeSpan.FromSeconds(30)); }) .AddServiceOptions<GreeterService>(options => { // This registers an interceptor for the Greeter service options.Interceptors.Add<UnaryCachingInterceptor>(); });

For examples on how to author an interceptors, take a look at these examples in the grpc-dotnet repo.

Give feedback


We hope you enjoy the new features in this preview release of ASP.NET Core and Blazor! Please let us know what you think by filing issues on GitHub.

Thanks for trying out ASP.NET Core and Blazor!

Daniel Roth
Daniel Roth

Principal Program Manager, ASP.NET

Follow Daniel   



https://www.sickgaming.net/blog/2019/06/...preview-6/

Print this item

 
Latest Threads
௹©Ukraine Shein COUPON Co...
Last Post: udwivedi923
1 hour ago
௹©Morocco Shein COUPON Co...
Last Post: udwivedi923
1 hour ago
௹©USA Shein COUPON Code ...
Last Post: udwivedi923
1 hour ago
௹©Armenia Shein COUPON Co...
Last Post: udwivedi923
1 hour ago
௹©Brazil Shein COUPON Cod...
Last Post: udwivedi923
1 hour ago
௹©South Africa Shein COUP...
Last Post: udwivedi923
1 hour ago
௹©Moldova Shein COUPON Co...
Last Post: udwivedi923
1 hour ago
௹©Malta Shein COUPON Code...
Last Post: udwivedi923
1 hour ago
௹©Luxembourg Shein COUPON...
Last Post: udwivedi923
1 hour ago
௹©Kazakhstan Shein COUPON...
Last Post: udwivedi923
1 hour ago

Forum software by © MyBB Theme © iAndrew 2016