# Sample app with .NET 5 (dotnet core) C# ASP.NET MVC

**URL:** <https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876>\
**Category:** General\
**Created:** [May 22, 2021, 8:49am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876 "2021-05-22T08:49:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![krompaco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krompaco/32/2010_2.png) [@krompaco](https://discuss.hotwired.dev/u/krompaco)\
**Post date:** [May 22, 2021, 8:49am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/1 "2021-05-22T08:49:04Z")

</div>

I really dig the Hotwire approach (thanks!) and it’s similar to what we’ve been doing with links and forms on our own for 10+ years.

Curious on if you have seen others setting up a boilerplates or recipes using [ASP.NET](http://ASP.NET) for the backend?

I have started a bit here and I have even gotten some simple WebSocket stuff to work:

> **[krompaco/hotwire-dotnet-mvc-ref](https://github.com/krompaco/hotwire-dotnet-mvc-ref)**
>
> The regular 5.0 MVC sample but with Webpack setup for Tailwind CSS and Hotwire with Turbo and Stimulus.

Outside of the .NET stuff there is also a working webpack.config.js in there that might interest others who are adding Tailwind CSS.

---

<div class="post-metadata">

**Author:** ![krompaco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krompaco/32/2010_2.png) [@krompaco](https://discuss.hotwired.dev/u/krompaco)\
**Post date:** [October 29, 2022, 8:50pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/2 "2022-10-29T20:50:18Z")

</div>

I renamed the repo (old links still work) and updated to .NET 6 and Razor Pages and worked through the setup a bit more…

Also add a demo site: [https://hotwired.azurewebsites.net/](https://hotwired.azurewebsites.net/)

Planning to add more examples onward!

---

<div class="post-metadata">

**Author:** ![krebil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krebil/32/3189_2.png) [@krebil](https://discuss.hotwired.dev/u/krebil)\
**Post date:** [November 11, 2022, 12:43pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/3 "2022-11-11T12:43:48Z")

</div>

I’ve been using .net and hotwire for about a year now, and I quite like them together. I stumbled into your repo a while back. It’s great to have a place with some examples, good job! Let me know if you need any help with more examples down the road. Have you done any work on a NuGet package yet? I think it would be great for making the barrier of entry lower.

---

<div class="post-metadata">

**Author:** ![colinkiama](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@colinkiama](https://discuss.hotwired.dev/u/colinkiama)\
**Post date:** [November 14, 2022, 11:12am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/4 "2022-11-14T11:12:43Z")

</div>

Feel free to add issues to your GitHub repository. I’d love to help. There’s a project I have planned that a Hotwired [ASP.NET](http://ASP.NET) Nuget package would be perfect for!

---

<div class="post-metadata">

**Author:** ![krompaco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krompaco/32/2010_2.png) [@krompaco](https://discuss.hotwired.dev/u/krompaco)\
**Post date:** [November 19, 2022, 10:27am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/5 "2022-11-19T10:27:08Z")

</div>

@krebil @colinkiama There’s not that much in that class library yet but maybe if more gets added on that level I could look into creating a package…

I’ve added some more samples and changed the setup a bit. View Components seem like a great fit to combine with Streams. See this new example: [Player list page](https://hotwired.azurewebsites.net/PlayerList)

I also stumbled over another package/project here: [NuGet Gallery | HotwireTurbo 1.0.0](https://www.nuget.org/packages/HotwireTurbo/#readme-body-tab)

I think I prefer mine for now 😄

---

<div class="post-metadata">

**Author:** ![krebil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krebil/32/3189_2.png) [@krebil](https://discuss.hotwired.dev/u/krebil)\
**Post date:** [November 22, 2022, 7:18am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/6 "2022-11-22T07:18:12Z")

</div>

@krompaco I think the package you linked here has some good ideas. A TurbostreamResult and tagHelpers are both really good features for a package. I would be hesitant to use something like that in production unless it got way more usage or I was a contributor. I’m always afraid that they will lose stop being worked on in the near future.

---

<div class="post-metadata">

**Author:** ![AdamLuczynski](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/adamluczynski/32/1510_2.png) [@AdamLuczynski](https://discuss.hotwired.dev/u/AdamLuczynski)\
**Post date:** [November 22, 2022, 6:28pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/7 "2022-11-22T18:28:22Z")

</div>

Glad to see that there is someone using [ASP.Net](http://ASP.Net) Core here!

HotwireTurbo 1.0.0 NuGet doesn’t work with NET 6. I opened issue but it seems project is dead.

However code and implementation is quite OK. I have to compare it with yours.

As for web socket: I would stick with SignalR. AFAIK using raw web sockets could be tricky.

I am glad to cooperate in making it into active project. Do you prefer discuss it here or on GitHub?

---

<div class="post-metadata">

**Author:** ![krompaco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krompaco/32/2010_2.png) [@krompaco](https://discuss.hotwired.dev/u/krompaco)\
**Post date:** [November 22, 2022, 6:54pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/8 "2022-11-22T18:54:51Z")

</div>

@AdamLuczynski Yes, agree on SignalR. I just found out about this sample: [GitHub - scottiemc7/hotwire-aspnet-demo-chat: A port of the Hotwire Rails Chat Demo to asp.net core](https://github.com/scottiemc7/hotwire-aspnet-demo-chat).

Should be easier to work with than the socket lab I have now. Maybe there is some other reference as well?

I think it’s better to discuss in deeper details on GH!

---

<div class="post-metadata">

**Author:** ![AdamLuczynski](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/adamluczynski/32/1510_2.png) [@AdamLuczynski](https://discuss.hotwired.dev/u/AdamLuczynski)\
**Post date:** [November 23, 2022, 12:33pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/9 "2022-11-23T12:33:43Z")

</div>

While browsing I found [Hotwire.dev · Issue #1 · khalidabuhakmeh/turbolinks.net · GitHub](https://github.com/khalidabuhakmeh/turbolinks.net/issues/1) and there seems to be another person willing to work on it.

---

<div class="post-metadata">

**Author:** ![krebil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krebil/32/3189_2.png) [@krebil](https://discuss.hotwired.dev/u/krebil)\
**Post date:** [November 24, 2022, 8:55am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/10 "2022-11-24T08:55:12Z")

</div>

I’ll put a link to this thread on the GitHub issue, that way he can come in and see all the good references. And join the conversation if he wants

---

<div class="post-metadata">

**Author:** ![krebil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krebil/32/3189_2.png) [@krebil](https://discuss.hotwired.dev/u/krebil)\
**Post date:** [March 27, 2023, 2:13pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/11 "2023-03-27T14:13:39Z")

</div>

I’ve collected a bunch of the helpers that I often add to my projects in case anyone is interested. I’ll probably make it into a NuGet package for my own benefit in a few days.  
Let me know if you spot anything that’s missing.

> **[GitHub - krebil/Hotwired-dot-net](https://github.com/krebil/Hotwired-dot-net)**
>
> Contribute to krebil/Hotwired-dot-net development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![krompaco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krompaco/32/2010_2.png) [@krompaco](https://discuss.hotwired.dev/u/krompaco)\
**Post date:** [July 22, 2023, 12:01pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/12 "2023-07-22T12:01:53Z")

</div>

I did some work to use dotnet 8 Preview 6 and Blazor SSR instead of Razor Pages 😅  
Will polish further closer to the release but already feels good.  
The Blazor component model is very nice and support to render components to strings comes in handy with Turbo streams.

> <https://github.com/krompaco/hotwired-aspnet/blob/feature/blazor-ssr/src/WebApp/Pages/Index.razor>

---

<div class="post-metadata">

**Author:** ![krebil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krebil/32/3189_2.png) [@krebil](https://discuss.hotwired.dev/u/krebil)\
**Post date:** [July 25, 2023, 9:58am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/13 "2023-07-25T09:58:48Z")

</div>

That’s super cool.  
HtmlRenderer in v8 is gonna make streams a lot easier to use

---

<div class="post-metadata">

**Author:** ![krompaco](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krompaco/32/2010_2.png) [@krompaco](https://discuss.hotwired.dev/u/krompaco)\
**Post date:** [August 14, 2023, 9:08am UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/14 "2023-08-14T09:08:40Z")

</div>

Updated to work with .NET 8 Preview 7 which is the last preview release, next up will be release candidate.

> <https://github.com/krompaco/hotwired-aspnet/blob/feature/blazor-ssr/src/WebApp/Pages/GlobalMessage.razor>

---

<div class="post-metadata">

**Author:** ![krebil](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/krebil/32/3189_2.png) [@krebil](https://discuss.hotwired.dev/u/krebil)\
**Post date:** [September 8, 2023, 2:01pm UTC](https://discuss.hotwired.dev/t/sample-app-with-net-5-dotnet-core-c-asp-net-mvc/2876/15 "2023-09-08T14:01:01Z")

</div>

I’ve updated my package ([GitHub - krebil/Hotwired-dot-net](https://github.com/krebil/Hotwired-dot-net)). I added some opt-in middleware for turbo frame requests. This will strip all the html (except for the turbo-frame itself and whatever turbo-streams may be present) to reduce the payload size before sending the response.

I think this can simplify my workflow so that my views can always render whole pages and then this can pick out the important parts whenever a frame requests a view. Sometimes I’ve had pretty big views which has tempted me to make frame specific endpoints, this alleviates that somewhat.
