If you want to password protect some pages on your MVC4 site using the Forms Authentication then it is best to to protect the whole site and then selectively allow Anonymous Access to the pages which are to be shown to every visitor. Open the FilterConfig.VB file and add the line filters.Add(New AuthorizeAttribute) in it […]
When the sql contains the single quotes then they have to be properly escaped otherwise it will give errors just pass the field value which you want to check and the following function will return you the properly escaped string. eg. o’brien will be returned as o”brien and this will not cause your sql to […]
Could not load file or assembly ‘System.Web.Http.WebHost, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly ‘System.Web.Http.WebHost, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified. Scenario I had a Visual Studio 2013 project using MVC4. The application was working fine in my local machine. But when I deployed the application using FileSystem( in this method all the […]
If you have had experience this problem then read ahead it is a simple fix. Here are the step to reproduce this problem in Visual Studio Here is what happened, I had a MVC4 project which was working fine. I created a new area called Admin. Created a new controller and a view […]
You start with a new project and you have created a winform with graphics and the functionality which you want to use in all your other forms in the same project. One would think that it is easily done as we can simply copy and paste the existing form and rename it and then suddenly […]
If you are getting this error while trying to use the DataRepeater in you Visual Studio 2010,12,13 project then look for the References under your project, if you project reference has two rows of Microsoft.VisualBasic.PowerPacks then remove one. You should end up with one entry in your references.
I realised that in my MVC5 project in Visual Studio I could not get the Ajax.BeginForm to work properly. It will always do a full postback. I was trying to complete a Video Rating Page, where there are buttons to rate a video and once the user presses one of the rating button, it […]
Here is a small function to return the GUID. GUID stands for Globally Unique Identifiers. GUIDs are 128-bit globally unique identifiers and they are generated automatically based on close to two zillion frequently varying factors. It has extremely low possibility that a generated GUID would equal to another GUID. Function GenerateGUID() as string return System.Guid.NewGuid.ToString() […]
Here is a simple way to do the role based Authorization in your MVC4 Controllers using VB.NET IF you have a role called Client then simply add the following text on top of your each ActionResult( which displays the view) <Authorize(Roles:=”Client”)> See the following example. The Index View has been restricted and can only […]
If you have to select one of the options from various possibilities then your best option is to use the case In VB.NET you would used something like below. Select [ Case ] testexpression [ Case expressionlist [ statements ] ] [ Case Else [ elsestatements ] ] End Select Here is more practical example: […]