tag:blogger.com,1999:blog-326961422024-03-13T13:31:40.525-05:00ASP.Net, C#, SQL, JQuery, SharepointYou will find discussion topics for ASP.net, C#, JQuery, AJAX, SQL, VB.net, .Net Framework, WCF, WPF, WWF, WSS 3.0, MOSS 2007, OOPs Concepts, SQL Server, Programming.Unknownnoreply@blogger.comBlogger535125tag:blogger.com,1999:blog-32696142.post-79907780395491472572023-11-14T14:16:00.003-06:002023-11-14T14:16:35.545-06:00SEO is simplified in Blazor .Net Core 8SEO is simplified in Blazor .Net Core 8. Simply put whatever HTML you may want to use in HeadContent Tag. Dynamic parameters can be added as shown below. @page "/"
<HeadContent>
<PageTitle>@title</PageTitle>
<meta name="description" content="@description">
<meta name="keywords" content="@keywords" />
<meta name="author" contentUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-34000856126587302742018-04-20T20:34:00.001-05:002018-04-20T20:35:17.655-05:00Content-Security-Policy in ASP.NET MVCFew good links for securing your asp.net mvc site
After applying SecurityHeaders validate
Content-security-policy-for-asp-net-mvc
Improving security in ASP.NET MVC using custom headers
Content-Security-Policy in ASP.NET MVC
Adding HTTP Headers to Improve Security
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-55962422636536675352017-03-28T05:33:00.002-05:002017-03-28T05:34:15.792-05:00Running Asp.net Core Web Application and Web API project on UbuntuStep 1: Install .Net Core on Ubuntu using this link
Step 2: On Terminal (Cntrl + Alt + T), go to /home/ directory. Create dir. i.e.: mkdir coredemo If you are new to ubuntu: /home/ directory is place where it is good to store user specific stuff.
Step 3: If you are creating
Asp.net Core web application, run command: dotnet web
Asp.net web api, run Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-15736434428251686992017-03-27T20:07:00.002-05:002017-03-28T04:46:15.690-05:00Efficient way of performing filtering, sorting and pagination with MongoDB C#Problem: I run into issue where pagination was bringing almost all the rows from the collection and then doing pagination. In other words it is doing in memory pagination which is inefficient. Recommendation: In order to do MongoDB pagination: avoid using LINQ Query.
Solution:
With following way you can easily and efficiently do filtering, sorting and pagination on mongoDBUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-26235795342140524722017-02-28T12:22:00.002-06:002017-02-28T12:22:48.263-06:00Getting SQL Server admin accessFollowing commands will provide you admin access for SQL Server instance.
Step 1: Run > Services.msc
Step 2: Stop SQL Server (Express)
Step 3: sc start mssql$sqlexpress -m -T3659 -T4010 -T4022
Step 4: sqlcmd -S [SQLInstanceName] -E
Example: sqlcmd -S ComputerName\sqlexpress -E
Step 5:
exec SP_ADDSRVROLEMEMBER 'domainname\username', 'sysadmin'
go
exit
Example:
exec Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-85611762920105658772016-11-26T12:50:00.001-06:002016-11-26T13:19:03.449-06:00Installing .Net Core on Digital Ocean HostingSupporting .Net on Linux OS is the best thing Microsoft gifted to .Net Developers. Linux hosting reduces cost, plus provide good stable support.
This post will walk you through how to get started by installing .Net Core on Digital Ocean Hosting.
I am assuming you already have created DigitalOcean Hosting account and are good to start by creating droplet. Reason I have choose Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-19055288474616106932016-04-04T09:41:00.000-05:002016-12-21T09:36:02.359-06:00Install Mongodb and run as a service to start automatically for windows
This blog post will explain where to download mongodb, how to install and how to configure to start service automatically.
Step 1: Download mongodb, I am using community edition. Follow step by step installation process to install mongodb.
After installation a directory inside C:\Program Files is created.
Example: In my case: C:\Program Files\MongoDB\Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-63099792631629646032015-06-05T12:44:00.000-05:002015-12-31T10:36:05.872-06:00Example of Inversion of Control and Dependency Injection
What is an IOC? or What is Inversion of Control?
IOC is mechanism by which we can add abstraction between
dependencies to make them loosely coupled code.
Abstraction is added through interface.
Now lets understand this by example.
Before Implementing IOC:
I have a class called "Black_And_White_Printer" which has one print() method. Print() method will print in Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-19105887180947017792015-06-02T18:23:00.003-05:002015-06-02T18:27:22.567-05:00Sql Server Restrict Memory usageWith growing of sql server database size and increase in page views of website, you might run in to memory crunch situation.
Please note: You might run into memory crunch situation for number of reasons like memory leak in code, etc, but in this article we will be focusing on only one scenario that is restricting sql server memory usage.
Cause of Memory crunch situation:
By default if Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-65457273067823950522015-05-29T14:23:00.000-05:002015-05-29T14:23:02.914-05:00Securing request pipeline of an ASP.NET MVC 5 ApplicationGood link describing how asp.net mvc request/response pipeline works.
If you are planning to make a custom security layer then this links may interest you.
Asp.net Mvc 5 Life cycle: http://www.asp.net/mvc/overview/getting-started/lifecycle-of-an-aspnet-mvc-5-application
Whtat is OWIN: http://www.asp.net/mvc/overview/getting-started/lifecycle-of-an-aspnet-mvc-5-application
OWIN and Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-13224426834754312672015-04-27T18:31:00.004-05:002015-04-27T18:38:19.406-05:00Create xml file from sql server table
Following code will create xml file from sql server table.
SQL Server Table
XML Output
<myroot>
<blogs>>/blogs>
<blogid>2601</blogid>
<title>Program to illustrate operator overloading from string</title>
<contentvalue&Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-61079784886580310412014-11-17T11:03:00.000-06:002014-11-18T11:12:07.317-06:00 Could not locate the assembly "System.Web.Mvc,Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSILMicrosoft recent security update has resulted in compilation error. After spending some time came across this link. This is a known issue.
Error: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-25197286593988060432014-11-16T11:11:00.000-06:002014-11-18T11:11:39.535-06:00Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
Error: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
Solution: Install Nuget Package Microsoft.AspNet.WebHelpers
Example: Install-Package Microsoft.AspNet.WebHelpers
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-18049195501341095012014-11-16T11:08:00.000-06:002014-11-18T11:11:51.191-06:00Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Error: Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Solution: Install Nuget Package Microsoft.AspNet.WebPages.Data
Example: Install-Package Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-38170228935998879302014-09-08T20:13:00.000-05:002015-12-18T12:42:05.841-06:00Solution: SSD Drive not getting detected on Win 10 OSRecently I have purchase Samsung - 850 EVO 500GB Internal Serial ATA Solid State Drive for Laptops - Black (Model: MZ-75E500B) in order to boost the performance of my laptop.
Issue: SSD Drive was not getting detected on Win 10 OS.
Solution:
This issue was occurring because SSD drive was new and their was no previous partition and disk was not been formatted. Steps to Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-79427987051371609952014-07-07T16:51:00.000-05:002015-12-18T12:42:20.035-06:00Update Table from Another Table in SQL ServerUpdate Table from Another Table in SQL Server: A simple scenario demonstrating how we can update Persons table with data from Employees table using update statement. A simple but very effective query which can saves you from creating unnecessary cursor for updating from different tables. By performance wise also Update statement is more efficient compared to creating update Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-29579427661240855342014-07-04T17:41:00.000-05:002015-12-18T12:42:40.387-06:00C# Object to Json Object String ExampleSingle C# Object to Json Object String Example
Download: https://github.com/dotnetguts/json2csharpAndcsharp2json
Install NewtonSoft.Json Nuget Package
C# Object we will be using in following example
class MemberPics
{
public string PhotoName { get; set; }
public bool IsModerated { get; set; }
}
Json Object String we will be using in following example
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-90313656079486024182014-07-04T17:30:00.000-05:002015-12-18T12:42:52.832-06:00Json String to C# Object ExampleSingle Json Object String to C# Object Example
Download: https://github.com/dotnetguts/json2csharpAndcsharp2json
Install NewtonSoft.Json Nuget Package
C# Object we will be using in following example
class MemberPics
{
public string PhotoName { get; set; }
public bool IsModerated { get; set; }
}
Json Object String we will be using in following example
@"{Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-20318657506464514042014-05-24T20:25:00.002-05:002014-05-24T20:30:15.439-05:00A connection was successfully established with the server, but then an error occurred during the login process. (Microsoft SQL Server, Error 233)Error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (.Net SqlClient Data Provider)
Solution:
Step 1: Open SQL Server Configuration Manager
Go to Windows 8 Start screen.
Start typing in SQLServerManager11.msc if you are looking for SQL Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-32696142.post-2920322090555165412014-05-24T20:22:00.000-05:002014-05-24T20:22:06.181-05:00Login failed for user. (Microsoft SQL Server, Error 18456)I was recently facing this error when created a SQL Server login and then try login using that newly created login.
Error: Login failed for user. (Microsoft SQL Server, Error 18456) (.Net SqlClient Data Provider)
Please note:
Solution is available on this link, but since microsoft has bad habit of link breaking issue; I have copied and pasted the solution for my reference.
http://Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-33342695290949641572014-02-06T04:10:00.003-06:002014-02-06T04:10:52.439-06:00Free ASP.NET Training for 2014Find this useful blog post on Scott hanselman blog
Bookmark for to do list
[01:00] - Windows Azure
[18:17] - Virtual Machines
[41:39] - SQL Database
[49:49] - Web Sites
[1:31:40] - Storage
[1:34:47] - Active Directory
1: What's New in ASP.NET 4.5
2: Building and Deploying Websites with ASP.NET MVC 4
3: Creating HTML5 Applications with jQueryUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-53217630324017698172013-11-12T23:06:00.002-06:002013-11-12T23:06:47.880-06:00Easiest Repository Pattern TutorialI would like to explain how to implement repository pattern before we proceed any further with our single page application discussion.
What is repository pattern?
Repository pattern separates the logic that retrieves the data from the database and logic that uses the data by your application. Thus it makes your data access layer independent of your presentation layer.
As shown in aboveUnknownnoreply@blogger.com9tag:blogger.com,1999:blog-32696142.post-7907424425889501652013-11-11T22:04:00.002-06:002013-11-11T22:04:26.277-06:00Understanding Flow of control for Hot Towel SPA TemplateLike any other application HTS is not following default route of having Global.asax as starting point. "I believe" this is not good and there are few other things which "I believe" you won't do it for your production code which we will be going to customize in upcoming blog post.
Flow of process for Hot Towel SPA template
App_Start/BreezeWebApiConfig.cs/RegisterBreezePreStart()
App_StartUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-20759592895271132952013-11-11T21:38:00.001-06:002013-11-11T21:38:46.992-06:00First Single Page App (SPA) using Hot Towel SPA TemplateIn this post, I will be creating our first SPA application using Hot towel SPA template.
If you haven't installed VS.Net 2012.2 Update, then please do it now before reading further.
Step 1: Open VS.Net and start creating asp.net mvc application
Step 2: There are 2 default template available for creating SPA application, choose "Hot Towel SPA" template
Step 3: Ones your Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-32696142.post-3948570343980896822013-11-11T19:37:00.000-06:002013-11-11T19:37:36.557-06:00Single Page Application (SPA) - OverviewFor those of you haven't got chance to work on Single Page Application (SPA), I will be discussing few of my learning in series of post, including how to perform CRUD operation using both Breeze and Web Api.
What is Single Page Application (SPA)?
(From Asp.net Site) ASP.NET Single Page Application (SPA) helps you build applications that include significant client-side interactions using HTML 5, Unknownnoreply@blogger.com0