Category: MVC

What is SignalR ? ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization. Features of this exercise after you complete: # Send real time message to client without client refreshing the page # Receive real time communication or message from client without refreshing the page. #Send message to all connected clients. # Send message to specific client. # Send message to all client except one who sent it… # This is a proof of concept …. you can extend it to the way you want… How to Install SignalR to MVC C# ? Steps : Open Visual Studio 2015 Create New MVC Project Install SignalR from Nuget Package – Install-Package Microsoft.AspNet.SignalR -Version 2.2.2 Create SignalR Hub Create Owin Startup File Create A view and include SignalR library reference Test the Application Extend the functionality to the ActionMethod Testing the […]

Error : Could not load file or assembly ‘System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.FileNotFoundException: Could not load file or assembly ‘System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. Solution : To resolve this issue before you publish the file make sure you select Copy Local to True from False If the dll property of the file — copy local is false means the file will not be copied to bin folder while publishing. Set it to true so that file will be copied to bin folder Screenshot before error: Solution This will copy the dlls while publishing to Bin folder

Scenario Using Rotativa as PDF convertor in ASP.NET MVC C# with Active directory login authentication Problem HTTP Error 401.2 – Unauthorized You are not authorized to view this page due to invalid authentication headers Cause : If you use Rotativa.ActionAsPDF it will not pass the header values related to authentication to the new page. So option is to use Rotativa.PartialViewAsPdf Sample Code: public ActionResult ConvertToPDF(string stdId, string vid) { TestModel model = dbfunctions.GetTestValue(stdId, vid); // send model as partial View Pdf not return new Rotativa.PartialViewAsPdf(“TestPDF”, model); } public ActionResult TestPDF(TestModel model) // model with values { // PartialView(pdf) not View(pdf); return PartialView(model); }

When you install new nuget packages you receive error as below. In order to resolve this follow this steps. Close Visual Studio Download Latest version of NuGet Package Manage and Install https://marketplace.visualstudio.com/items?itemName=NuGetTeam.NuGetPackageManagerforVisualStudio2013 Step 3: After installation open the Visual Studio and try to install NuGet Package!!!

Earlier I was posted an article on Integrating Summernote on MVC ASP.Net . I received couple of feedback’s where users were facing issue with large content as the entire data including image will be send to the database and there will be with size of images. As we aware that there is TinyMCE editor which lacks in the area of Image Uploading. Image upload is not realistic in TinyMCE, however apart from that it has all the rich text editing features. On the other hand Uploadify is a really simple file uploading jquery plugin which helps us in on the fly uploading of the files. In this project I have merged the functionality of the above two and integrated with MVC ASP.NET C# for easy implementation in any of the project. Features: Rich Text Editing Features of TinyMCE ( You can enhance the features referring to this documentation ) Easy Image upload feature with restriction on file extension as well on file sizes. Seamlessly integrated Uploadify with TinyMCE , even works well with Multiple Files. Uploaded images are stored in the server and only reference is added to text editor hence making the content data small as possible. Complete […]

Scenario : You want to create an web application which supports multi language. Your site may contain models , form labels, hyper links which needs to be in the required language. We can also have a language switcher. Solution : Use Resource .resx xml file. Tools Required : Visual Studio 2013 Features: Extend as many number of Languages you want Form can be created with different language labels Link labels can be changed language switch option Easily editable Resource Files Create New Project Select Web ==> Asp.net MVC4 Web Application ==> Project Name :: Haneef Select Internet Application Right Click Project Name ==> Add New Folder ==> Name it as Resources Right Click Resources Folder which we created ==> Add New Item Select General Tab from left Hand Side and Select Resources File from Right Side Name the new file as LangText.Resx Now Enter the string Name and Value as shown below, Click Access Modifier as Public, Then Click Save All as shown Now Right Click LangText.Resx ==> Copy Paste to Same Folder Now Rename the Pasted File as LangText.Ar.Resx Now Edit the Content of Resx file to include Arabic Translations and Save. Now Again make a copy for Kannada […]