Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores

ASP.NET


A DotNet Intern's dilemma: Learn ASP.NET Core MVC or ASP.NET Core Web API?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
A DotNet Intern's dilemma: Learn ASP.NET Core MVC or ASP.NET Core Web API?

I am on the side of skipping MVC and focusing only on learning Web Api. The primary reason as to why I want to skip learning MVC is that you don't need MVC because when you have your front-end ready in Angular then you can just return data using HTTP response from a Web Api and display it in your Angular frontend. So by using WebApi+Angular, I am actually getting MVC functionality and so why should I learn MVC?! What's even the point of MVC's existence?

Am I thinking wrong right now? Feel free to correct me as I am just an intern at a service based startup with zero year experience.


Asp.net core Auth documentation is one of the worst I've ever seen
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
Asp.net core Auth documentation is one of the worst I've ever seen

I have been trying to understand asp.net core auth for 3 weeks now. I don't want to do nothing exceptional, just a simple authentication with an external provider like Google. The configuration part? Yeah really simple I have no complains. The problem is what comes after? Naah, literally what comes next? I have configured the auth provider now what? Where do I go from that? It's sad that I have to rely on chatgpt to help, it sucks because I have to take a little from here and there. Like there's no straight guide documentation on what to do after the configuration like seriously. How am I supposed to know I need to use the http context.authenticate method when you guys don't provide any info about it? Do they do this on purpose? Had I know about this I wouldn't even have started studying this framework.


Is Mac suitable for ASP.NET development?
r/csharp icon
r/csharp

All about the object-oriented programming language C#.


Members Online
Is Mac suitable for ASP.NET development?

I have a "gaming" laptop from lenovo, which is totally cool for gaming and working while charging cable connected, however when i need to unplug it and go somewhere - it's not holding more than an hour. So, I'm planning to sell it and have a pair of stationary pc (mainly for gaming)+ macbook(work station). Will I encounter any difficulties in learning c#/asp.net on macOS?




Can't MSFT rename ASP.Net Core to ASP8 or something?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
Can't MSFT rename ASP.Net Core to ASP8 or something?

I hate Microsoft's inconsistency in naming. .NET Core has become .NET, but EF Core and ASP.NET Core are still called XX Core. Can't they find a way to unify the names? Every time I search or ask an AI without adding "Core" at the end, the results are different. It's very troublesome. ASP.net core, too long to type.


How is Asp.net so fast?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
How is Asp.net so fast?

Hey guys

I've been playing around with different web frameworks and noticed that Asp.net is remarkably faster than everything else. For example, according to my tests on my laptop, minimal API is ~4x faster than running a server with Go's HTTP package.

So, my question is: Am I measuring something horribly wrong, or does Asp.net use black magic to achieve this kind of performance?

Here is my testing methodology:

The objective is to test only the framework's performance (not the logger or the db driver). So, for every language and framework, I wrote a simple HTTP server that returns a JSON encoded { "hello": "world" } object.

I ran those servers in docker containers with 0.5 CPUs and 300 MB of memory.

For benchmarking I used autocannon

autocannon -c 100 -d 30 -p 10 localhost:3000

Here are the exact results on my machine (MBP15 2018. 2,2 GHz 6-Core Intel Core i7)

Dotnet

┌─────────┬───────┬───────┬───────┬───────┬──────────┬──────────┬────────┐
│ Stat    │ 2.5%  │ 50%   │ 97.5% │ 99%   │ Avg      │ Stdev    │ Max    │
├─────────┼───────┼───────┼───────┼───────┼──────────┼──────────┼────────┤
│ Latency │ 10 ms │ 21 ms │ 85 ms │ 91 ms │ 37.89 ms │ 26.77 ms │ 115 ms │
└─────────┴───────┴───────┴───────┴───────┴──────────┴──────────┴────────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec   │ 22927   │ 22927   │ 26191   │ 29023   │ 26065.6 │ 1534.87 │ 22927   │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 4.04 MB │ 4.04 MB │ 4.61 MB │ 5.11 MB │ 4.59 MB │ 270 kB  │ 4.04 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘

783k requests in 30.06s, 138 MB read

Go HTTP

┌─────────┬──────┬───────┬────────┬────────┬───────────┬───────────┬─────────┐
│ Stat    │ 2.5% │ 50%   │ 97.5%  │ 99%    │ Avg       │ Stdev     │ Max     │
├─────────┼──────┼───────┼────────┼────────┼───────────┼───────────┼─────────┤
│ Latency │ 1 ms │ 89 ms │ 610 ms │ 797 ms │ 152.06 ms │ 182.89 ms │ 1917 ms │
└─────────┴──────┴───────┴────────┴────────┴───────────┴───────────┴─────────┘
┌───────────┬────────┬────────┬────────┬────────┬────────┬─────────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg    │ Stdev   │ Min    │
├───────────┼────────┼────────┼────────┼────────┼────────┼─────────┼────────┤
│ Req/Sec   │ 5927   │ 5927   │ 6463   │ 7415   │ 6511.2 │ 350.15  │ 5926   │
├───────────┼────────┼────────┼────────┼────────┼────────┼─────────┼────────┤
│ Bytes/Sec │ 794 kB │ 794 kB │ 866 kB │ 993 kB │ 872 kB │ 46.9 kB │ 794 kB │
└───────────┴────────┴────────┴────────┴────────┴────────┴─────────┴────────┘

196k requests in 30.04s, 26.2 MB read

Here is the repo with more results and the source code

Edit

I've found a Go framework called fiber that uses fasthttp instead of the default HTTP package. It seems to be even faster than Asp.net (by ~50%)

┌─────────┬──────┬───────┬───────┬───────┬──────────┬──────────┬────────┐
│ Stat    │ 2.5% │ 50%   │ 97.5% │ 99%   │ Avg      │ Stdev    │ Max    │
├─────────┼──────┼───────┼───────┼───────┼──────────┼──────────┼────────┤
│ Latency │ 5 ms │ 13 ms │ 73 ms │ 79 ms │ 24.85 ms │ 21.97 ms │ 130 ms │
└─────────┴──────┴───────┴───────┴───────┴──────────┴──────────┴────────┘
┌───────────┬─────────┬─────────┬─────────┬───────┬──────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5% │ Avg      │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼───────┼──────────┼─────────┼─────────┤
│ Req/Sec   │ 34047   │ 34047   │ 39903   │ 44831 │ 39413.34 │ 2456.15 │ 34022   │
├───────────┼─────────┼─────────┼─────────┼───────┼──────────┼─────────┼─────────┤
│ Bytes/Sec │ 4.56 MB │ 4.56 MB │ 5.35 MB │ 6 MB  │ 5.28 MB  │ 329 kB  │ 4.56 MB │
└───────────┴─────────┴─────────┴─────────┴───────┴──────────┴─────────┴─────────┘

1183k requests in 30.05s, 158 MB read

The point is that there is plenty of information in their readmes about how they achieved that performance.

  1. Reuse of request and response objects with ring buffers

  2. More efficient storage of headers

  3. Using []byte instead of string where possible. The conversion is cheap but not free

  4. Avoiding unnecessary allocations

  5. Not using regexp for parsing routes =D

While this does not directly apply to Asp.net it still shows what kind of "black magic" people use to gain performance.

Edit

If you can add to the list above something specific to ASP.NET or confirm that ASP does use something like ArrayPool to reuse requests and responses (or anything else with real examples) I would be grateful.

To clarify, the goal of this post is not to dunk on any framework or language. It's to find what cool things people are doing to go blazingly fast.


ASP.NET MVC without using entity framework
r/csharp icon
r/csharp

All about the object-oriented programming language C#.


Members Online
ASP.NET MVC without using entity framework

I'm looking for good examples that follow best practices to help me make an MVC app with basic database actions like create, read, update, and delete, but I don't want to use Entity Framework - I prefer sticking to just SQL. Most tutorials use entity framework, so I'm wondering if there are any examples that focus on SQL without ORM?


Would like to automate ASP.NET Core deployments
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
Would like to automate ASP.NET Core deployments

I'm a long-time developer who currently maintains several ASP.NET Core websites. A couple of those sites are in use 24x7.

Currently, the way I deploy these websites is publish from Visual Studio to a folder, I copy those files to a temp folder on the server, I take the site down by copying app_offline.htm to the site folder, and then manually copy all the files to the live website folder.

This works but the manual steps take longer than necessary and also leave room for me to make stupid mistakes.

I started thinking about writing a program to copy the files automatically? But it occurs to me that thousands of people are doing this already. So there must be well established techniques for doing this. Can someone offer some suggestions for how I might approach this, or direct me to some articles that discuss my options?

Note: I am not on Azure. I'm just running IIS on a virtual private server.

Thanks!


RE:"Bing searches related searches... badly. Almost cost a user his job." (From A Full Stack ASP.NET Dev)
r/sysadmin icon
r/sysadmin

A reddit dedicated to the profession of Computer System Administration.


Members Online
RE:"Bing searches related searches... badly. Almost cost a user his job." (From A Full Stack ASP.NET Dev)

Original Post: https://old.reddit.com/r/sysadmin/comments/p2gzi9/bing_searches_related_searches_badly_almost_cost/

As a Full Stack ASP.NET Developer(platform Bing is Built on), I read this thread and saw a lot of blatant misinformation. I'd like to provide some advice on how to read network logs so that no one makes the same mistake.

OP posted an example of how Bing supposedly "preloads related searches":

https://i.imgur.com/lkSHswE.png

As you see above, OP searches for "tacos" on Bing Images, and then there seems to be a lot of requests for related queries, such as "Chicken Tacos"

However, if you pay attention, you can clearly tell that those are not search queries, but rather, AJAX requests initiated by the page itself.

AJAX is basically a way for the client JavaScript to make requests to the server without reloading the page. This is how "endless scrolling" works, and also leads to faster, more responsive websites. It can also be used to load less important content such as images after the main page already loaded, improving UX.

Let's break down the urls, first by starting with the original search URL:

https://www.bing.com/images/search?q=tacos&form=HDRSC2

/images/ tells ASP.NET to look for the images "controller" which is a C# or VB class containing 1 or more methods

/search tells the controller to run the "Search" public method.

?q=tacos&form=HDRSC2 passes 2 parameters to the Search method. The first is obviously the query the user typed, the second doesn't really matter.

Next, let's look at the URL for one of the "automatically ran related searches"

https://th.bing.com/th?q=Mexican+Chicken+Tacos&w=166&h=68&c=1&rs=1&pid=InlineBlock&mkt=en-US&adlt=moderate&t=1

th.bing.com First thing any sys admin should notice is this is an entirely different subdomain which should raise questions immediately.

th? it is calling the th controller at a completely different domain. Because no method is specified, it will run the index method

q=Mexican+Chicken+Tacos&w=166&h=68&c=1&rs=1&pid=InlineBlock&mkt=en-US&adlt=moderate&t=1

You can clearly see there are a LOT more parameters being passed here than the other query. Seeing w=166&h=68 should be a hint that these are parameters for an image.

What is happening here is after you search for tacos, there is AJAX that runs and sends a request to Bing to load the preview image for the related search query(in this case, a Chicken Taco). The reason Microsoft does this instead of just loading everything at once is because by requesting images AFTER the page has loaded, the page can load quicker rather than the user having to wait for everything.

In this particular case, the subdomain should've been a dead giveaway that it wasn't a search. But in some cases it's even possible that AJAX requests can use the same path. Through something called "overloading", the same URL can run a completely different method based on how many parameters are supplied.

So what's the key takeaway here?

1.When viewing logs, pay attention to both the subdomain and the parameters passed to determine if the user actually actively navigated to a link, or if the request is a result of AJAX scripting.

2.The presence of a concerning phrase in a POST/GET request is not inherent proof that a user is engaging in that type of content. For example, if you accidentally hover over a Reddit username, it performs an AJAX request to:

https://www.reddit.com/user/Skilliard7/about.json

So if my username was something VERY NSFW, it would look like you were looking at a NSFW reddit user's profile, when in reality your mouse happened to pass over my username, but you never clicked it.

3.Bing is NOT automatically searching related searches, but they should stop recommending illegal search queries because it's just wrong

edit: I appreciate the support, but please don't Gild me as I dislike Reddit's management and direction. Instead please donate to FreeCodeCamp or a charity of your choice instead.



How much harder will it be as an ASP.NET MVC developer to learn ASP.NET webforms?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
How much harder will it be as an ASP.NET MVC developer to learn ASP.NET webforms?

I am currently interviewing for a role that mostly developed apps in webforms which I have no experience with. How much harder/easier will it take for me to pick up if I already know MVC?

Edit: Thanks everyone for confirming my thoughts on this subject. I am well aware this is going backwards in terms of tech stack. For what it’s worth, this role is for a city government job which means more stability especially in this job market. The only reason why it is appealing to me is that I can move back home closer to family but I know I will probably hate myself if I have to do outdated tech.


Why are so many of you talking about using AOT in ASP.NET Applications?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
Why are so many of you talking about using AOT in ASP.NET Applications?

I've seen a lot of threads on this subreddit from users talking about building ASP.NET / Web applications using the improved AOT capabilities in .NET 8. I am confused as to why this is.

AOT in this context provides no real benefits, outside of improving cold startup times for serverless, and even then that benefit is really quite marginal in the grand scheme of things.

AOT's primary benefit is being able to building and distribute .NET applications without distributing the .NET runtime itself - that's very useful for distributing things like desktop + mobile + console applications. With AOT trimming you can also further reduce the binary size of the native executable, which makes sense for things like mobile applications that are being downloaded over metered bandwidth.

In a web environment where _you control the execution runtime of the application and the hardware it runs on_, however, there's not much benefit to doing this. .NET's JIT with Dynamic PGO enabled (which it is by default in .NET 8 now) will always produce better-performing code over the long run. On top of that, AOT reduces your options in terms of third party library support (i.e. no Newtonsoft) and some of your own code choices .

If you're looking at building an ASP.NET application and you currently plan on using AOT, why?


Version Numbering Strategy for ASP.NET
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
Version Numbering Strategy for ASP.NET

I work in an organization that, to put it bluntly, has no consistent or well-thought-out strategy for deciding and assigning version numbers to internal-facing applications.

My role is on a team developing with ASP.NET in .NET 8, and I'm in a position to implement a new strategy.

From a very high-level, I'd like to use an easy-to-understand method to ensure that I can look at a running app or the underlying exe and know the version number, and have that version number be referenced somewhere in the commit.

The most recent existing system I worked on implemented the version number as a manually incremented value (e.g. major.minor.patch.manually-incremented-build-number) assigned to AssemblyVersion and AssemblyFileVersion within AssemblyInfo.cs (it was on 4.8). This worked okay tbh, but there were many cases of the build number not being incremented because someone forgot before they committed.

What was nice about that approach it is that it's straightforward - the version is visible from File Explorer, it's visible from Assembly.GetExecutingAssembly().GetName().Version, and I suppose you can create a matching tag in Git to see the version there as well.

ChatGPT suggested a few different ideas, including GitVersion. I recognize there are many solutions to this and a lot probably integrate with the deployment pipeline in some way, but we don't really have much of one of those either...yet.





ASP.NET with HTMX stories and opinions.
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
ASP.NET with HTMX stories and opinions.

Asking the community for their opinion on ASP.NET with HTMX. It looks like a great way to more tightly couple the backend with the front-end and solves a major problem of keeping the two in sync and avoiding the chaos of JavaScript client side libraries. Has anyone had good or bad experiences using it?



Would you choose ASP.NET MVC for a new project? If so, why?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
Would you choose ASP.NET MVC for a new project? If so, why?

Currently embarking on a new project and my gut reaction was to use MVC because after many, many years of writing ReactJS frontends with ASP.NET API's, I thought it'd be nice to fall back to something which is architecturally simpler.

Then I started thinking about what users expect from modern web user interfaces and quickly realised that I'd be reaching for tools like jQuery and effectively implementing a watered down WebAPI/JavaScript frontend, just without the "hard" segregation of frontend/backend.

Just looking for a sense check on my logic here - MVC + jQuery and ReactJS + WebAPI - both are valid approaches but is the former *really* saving time and complexity?




How to choose between ASP.NET Core MVC, ASP and Blazor?
r/dotnet icon
r/dotnet

.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!


Members Online
How to choose between ASP.NET Core MVC, ASP and Blazor?

Hello, I am currently planning to make a web app, that will have a lot of user interactions, for example there will be a custom editor, that I would parse and realtime show a result, all of this will be able to run for multiple users at the same time, like lets say google docs..

To give you a little bit of context I am currently working as a fullstack typescript dev, and my plan was to switch to the .NET stack, as I've started hating typescript syntaxes, speeds and stuff.

Now I'm having a little bit too much of a decision fatigue, as it's really hard for me to choose between these frameworks(ASP.NET Core MVC, ASP and Blazor). What I've seen is that ASP.NET Core MVC is the industry standard, it's really structured and can be a lot bloated, it can perform server-side and client-side using razor or js frameworks which I wanted to avoid using js at all.
On the other side, Blazor seems a lot more appealing to me as it tries to eliminate the use of js, it can perform too server-side and client-side using WASM, I don't know if thats possible to do in the same project tho, that would be very beneficial, and looks easier to understand and is more concise. Why would someone prefer MVC looking at Blazor? I must be missing something.

Can someone help me like decide what would be the best choice for my usecase, overall tell me the advantages and disadvantages? I am really sorry if this comparison is being asked a lot, I have searched a bit and the sources that I found confused/overwhelmed me. All help is appreciated.



  • News, posts, articles about ASP.NET Core (formerly ASP.NET 5) members
  • .NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place! members
  • All about the object-oriented programming language C#. members
  • Computer Programming members
  • A subreddit for all questions related to programming in any language. members
  • ASP.NET MVC members
  • A community dedicated to all things web development: both front-end and back-end. For more design-related questions, try /r/web_design. members
  • members
  • Development for ASP.NET MVC with Bootstrap made simple. members
  • members
  • Some redditors are skilled professionals, some redditors need skilled professionals. Scroll down for general information and our rules. Please read through these carefully, as breaking them can be a bannable offense. members
  • Learn C# is about learning C#! Post your questions regardless of your experience level. members
  • Angular is Google's open source framework for crafting high-quality front-end web applications. r/Angular2 exists to help spread news, discuss current developments and help solve problems. Welcome! members
  • CSCareerQuestions is a community for those who are in the process of entering or are already part of the computer science field. Our goal is to help navigate and share challenges of the industry and strategies to be successful . members
  • This group is for people interested in the F# language, the functional-first language targeting .NET, JavaScript, and WebAssembly. More info about the language can be found at https://fsharp.org members
  • A community for discussing anything related to the React UI framework and its ecosystem. Join the Reactiflux Discord (reactiflux.com) for additional React discussion and help. members
  • Join us in discord here: https://aka.ms/azurediscord. members
  • /r/netsec is a community-curated aggregator of technical information security content. Our mission is to extract signal from the noise — to provide value to security practitioners, students, researchers, and hackers everywhere. ‎ members
  • Ask questions about programming. members
  • For anything funny related to programming and software development. members
  • EasyXLS™ is the best .NET and Java Excel library to read, write or convert Microsoft Excel files, an Excel reporting tool for programmers, a library to export and import Excel files. File formats: XLSX, XLS, XLSM, XLSB, CSV, TXT, XML, HTML. - C# Excel library - VB.NET Excel library - PHP Excel library - Classic ASP Excel library - Java Excel library - ColdFusion Excel library - C++ Excel library - VB6 Excel library - VBScript Excel library - Python Excel library members
  • A community for the awesome MVC JS framework. members
  • Vue.js is a library for building interactive web interfaces. It provides data-reactive components with a simple and flexible API. members
  • Welcome to the **Star Wars Expanded Universe** subreddit! We are primarily a source of discussion and news surrounding the Star Wars LEGENDS and STORY GROUP CANON Expanded Universe Stories. If you want to get into Legends, Canon, or both or want to learn more about the Expanded Universe in general, you can find a few links in the sidebar that may be helpful. Feel free to ask the community as well! Also, join our [Discord](https://discord.gg/j2A9gwQ) for even more discussion. members
  • Content specific to Angular. If you're looking for AngularJS or Angular 1 related information, check out r/AngularJS. members
  • members
  • Tutorials, news, tips & tricks in server-side programming languages. Ruby, PHP, ASP.NET, Python, Go, Java, C, D and the rest... members
  • Community of Pinoy programmers to share ideas, projects, job vacancies and socialize with fellow programmers. members
  • members
  • A place for people to group up to learn and teach programming to each other. members