If I want to display a PDF file in the browser instead of downloading a copy, I can tell the browser via an additional Content-Disposition response header.
This code example assumes that the file content is available as byte-array, reading the content from a database, for example.
// Get action method that tries to show a PDF file in the browser (inline)
public ActionResult ShowPdfInBrowser()
byte pdfContent = CodeThatRetrievesMyFilesContent();
if (pdfContent == null)
var contentDispositionHeader = new System.Net.Mime.ContentDisposition
Inline = true,
FileName = "someFilename.pdf"
return File(pdfContent, System.Net.Mime.MediaTypeNames.Application.Pdf);
Please keep in mind that ultimately we don’t have control over the browser. We can politely request to show the PDF inline, but this can be overridden by a user configuration, for example.
Staring at our screen all day long can take a toll on our eyes:
I was forced to wear glasses a few years ago for which I blame my screen-time. Since then I am more conscious about the health of my “biological data interface” (eyes) and just got myself computer glasses with blue filter, although I am not sure if they are necessary. The information available on the web is contradictory, but I have an acquaintance who fixed her problem getting tired with computer-glasses.
What DID convince me though is this free tool for Windows-User: EyeLeo. It will ask me every now and then to exercise my eyes. Together with Tomighty Pomodoro timer I get the frequent breaks I need to finish my work days without my eyes hurting.
If you just published your web app to Azure with Visual Studio you probably won’t have a FTP account configured in your App Service. I just want to share how to set it up to enable downloading logs via FTP.
If you go to “MONITORING-> Diagnostics logs” in your App Service you should see the text “No FTP/deployment user set” in the field FTP/deployment username:
Use the page “DEPLOYMENT -> Deployment credentials” to set up a new FTP user:
If you go back to “Diagnostics logs” you will see the FTP/deployment username you can use to access the logs with the FTP client of your choice (On Windows I like to use WinSCP):
Important: You have to use the full FTP username shown on the “Diagnostics logs” page consisting of the App Service name, a backslash followed by the FTP username:
Hint: Try to avoid FTP and use FTPS instead to protect your credentials and data.
Windows Update will update NuGet packages only for targeted security updates
Supported .NET version: 4.5.1. or newer
MS .NET NuGet packages treated as part of the .NET framework
Security update notifications are posted to .NET blog. Subscribe!
Microsoft Update records loaded MS assemblies on a machine to identify candidates for patching.
Apps using a vulnerable NuGet package will get served the patched Assembly via GAC Publisher Policy.
I am now more confident that using NuGet packages I get critical updates for my applications when needed when Windows Update is used.
But: I would like to see a more recent document about the treatment of Security issues in NuGet. (Pease leave a comment if you have something and I will update the post). And I would like to know why the NuGet package feed list is empty.
A video tutorial based on my learnings of ASP.NET MVC 5, ASP.NET Identity, SQL Server and Azure.
Summary: I will show you how to create a very simple web application with user authentication. Users can register, log in, create diary entries (text) and visualize their entries.
In part one we will create, test and refactor the application locally on our computer. Although the app is very simple we will touch a lot of different technologies. You will also see some issues you may experience when starting with ASP.NET MVC in Visual Studio and how to fix them.
In part two we will publish our app to the cloud (Azure). Please subscribe to get notified when part two is finished.
ASP.NET Identity ApplicationUser and ApplicationDbContext overview
ASP.NET Identity tables
Extend DiaryEntry model class for usage in DbContext
Create foreign key property and navigation properties (Entity Framework)
Add new DiaryEntry table to DbContext
Create new model class from viewmodel
Use Entity Framework to insert into DiaryEntries table
Show result of data-model change: “Server Error in Application. The model backing the ‘ApplicationDbContext” context has changed since the database was created. Consider using Code First Migrations to update the database”
Your global authentication-default is “requires authentication”. You create a new action method on a controller that should be accessible without authentication and forget to add the [AllowAnonymous] attribute.
Resultingissue: You try your application, can’t enter that new page and fix it. In the worst case you didn’t do your homework and a customer/user finds the bug and complains to you.
Which issue would you rather have to deal with?
I personally prefer the whitelisting approach and err on the side of caution.
Have you been thinking of starting a blog? Then you probably know that it can look like a huge and frightening task…
I have thought about starting one several times in the past.
I then asked myself a lot of questions and got overwhelmed by the answers I found by myself or using google:
How to name my blog?
Which blogging platform to use?
As a IT professional, should I install and setup my baby manually?
What to blog about?
What language to blog in (with German, English and Spanish to choose from in my case)?
Do I have anything to add to the internet? So much stuff already out there….
Who am I, to <fill in the blank>?
If you have an introvert tendency like me all these unknowns can give you the excuses you need to NOT get started at all.
Luckily I stumbled over John Sonmez SimpleProgrammer-website and Youtube-channel. After consuming a lot of his free content he is putting out there I finally tried his blog-course and I am glad I did! He managed to simplify the task at hand and use his psychology skills to destroy all your excuses one after another so you can’t help but get that thing up and running!
The fact that you are reading this is the proof! 🙂