What’s new in .NET Framework 4.7.1 (Part 3)

New Release .NET Framework 4.7.1

Hello Readers,

This post is in continuation with “What’s new in .NET Framework 4.7.1 Part 2“.

[Whats new in .Net Framework 4.7.1 Part 1,Whats new in .Net Framework 4.7.1 Part 2]

New Features includes:

WPF – Changing implicit data templates 

  • This feature enables the automatic update of elements that use implicit DataTemplates after changing a resource.
  • When an application adds, removes, or replaces a value declared in a ResourceDictionary, WPF automatically updates all elements that use the value in most cases, including the implicit style case:<Style TargetType=”Button”.
Continue reading “What’s new in .NET Framework 4.7.1 (Part 3)”
Advertisements

What’s new in .NET Framework 4.7.1 (Part 2)

New Release .NET Framework 4.7.1

Hello Readers,

This post is in continuation with “What’s new in .NET Framework 4.7.1 Part 1“.

New Features includes:

Accessibility improvements

.NET Framework 4.7.1 brings in a lot of accessibility improvements across different libraries to align with the broad Microsoft product accessibility goals. 

Windows Forms Accessibility improvements

Windows Forms accessibility changes are in the following areas:

  • Improved display during High Contrast mode
  • Enhanced UI accessibility patterns
  • Improved UI Accessibility properties with the outcome of improved experiences in accessibility tools like Narrator

High Contrast Improvements

Various controls in WinForms are now improved in the way they render under the various HighContrast modes available in the Operating System (OS).

Continue reading “What’s new in .NET Framework 4.7.1 (Part 2)”

Download a PDF file stored in a network location

In View page (.cshtml) Create a Link using anchor tag and define href field as:

href = ‘@Url.Action(“Download”, “YourControllerName”,new{filePath = “”})’

public FileResult Download(string filePath)
{
MemoryStream ms = new MemoryStream();

byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
string fileNAme = Path.GetFileName(filePath);

string tmpPath = Path.GetTempPath();
tmpPath = tmpPath + fileNAme;

PdfReader pdfReader = new PdfReader(fileBytes);

PdfReader.unethicalreading = true;
FileStream sourceFileStream = new FileStream(tmpPath, FileMode.Create, FileAccess.Write);
PdfStamper pdfStream = new PdfStamper(pdfReader, sourceFileStream);
string waterMark= "Confidential"
for (int page = 1; page <= pdfReader.NumberOfPages; page++)
{
Rectangle pageRectangle = pdfReader.GetPageSizeWithRotation(page);
PdfContentByte pdfData = pdfStream.GetUnderContent(page);
pdfData.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.NOT_EMBEDDED), 50);
PdfGState graphicsState = new PdfGState();
graphicsState.FillOpacity = 0.6F;
pdfData.SetGState(graphicsState);
pdfData.SetColorFill(BaseColor.GRAY);
pdfData.BeginText();
pdfData.ShowTextAligned(Element.ALIGN_CENTER, waterMark, pageRectangle.Width / 2, pageRectangle.Height / 2, 45);
pdfData.EndText();
}
pdfStream.FormFlattening = true;
pdfStream.Close();
pdfStream.Dispose();
sourceFileStream.Close();
sourceFileStream.Dispose();

byte[] byteArray = System.IO.File.ReadAllBytes(tmpPath);
System.IO.File.Delete(tmpPath);
ms.Write(byteArray, 0, byteArray.Length);
ms.Position = 0;

return new FileStreamResult(ms, "application/pdf");
}

To use above code you need iTextSharp dll. you can install it using Nuget as: Install-Package iTextSharp

References :
<ul>
<li><a https://developers.itextpdf.com/itextsharp-net</a></li>
</ul>

ASP .NET MVC Architecture History

MVC 6.0 | ASP .NET vNext

  •          Single Programming Model for ASP.NET MVC and ASP.NET Web API.
  •          Cloud Computing: MVC 6.0 is optimized for Cloud Computing.
  •          Supporting side by side deployment of runtime and framework along with application. In order to dynamically compile code, Roslyn compiler is used
  •         Dependency injection: MVC 6.0 provides Out of the box support for dependency injection.
  •         vNext is Open Source and supports multiple platforms including Linux and Mac.
  •         New JSON-based project Extension.

MVC 5.0

  •         Visual Studio 2013.
  •         .Net Framework 4.5
  •         It was released on 17th Oct 2013.

New features in MVC 5.0:

Continue reading “ASP .NET MVC Architecture History”