Here we will see how to resolve an issue that comes after you have upgraded to Windows 10. After upgrading the system visual studio started showing errors that Metadata file .dll could not be found. After re-building, re-starting the solution as well as changing the references nothing changed and the errors still appeared. If you closely look at the Build failed errors you will find the below para.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(2234,5): warning MSB3283: Cannot find wrapper assembly for type library “MSHTML”. Verify that (1) the COM component is registered correctly and (2) your target platform is the same as the bitness of the COM component. For example, if the COM component is 32-bit, your target platform must not be 64-bit.
Now this is very the problem is. If you check your references you will find an yellow warning mark to MSHTML. If you check this with your windows 8.1 machine it will be pointing to an ActiveX control that was registered from a file in GAC.
Continue reading FIX for Wrapper assembly for type library “MSHTML” cannot be found after Windows 10 upgrade.
Here we will see how to solve one of the most common runtime error ““Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.””
This error may occur in the following scenario’s
Reason for this exception occurrence is because page execution is stopped and sent to the Application_EndRequest event in the application’s event pipeline.
When we call Response.End method it stops the page execution and raises the EndRequest event and thus the line of code after Response.End is not executed. Same thing happens when we use Response.Redirect and Server.Transfer methods because both they both call Response.End internally.
When a call is made to destroy a thread, the CLR internally throws a ThreadAbortException. This is a exception that can be caught and handled explicitly.
Use a try-catch statement to catch the exception as below
While using Response.Redirect we can use an overload of the same
Response.Redirect(String url, bool endResponse);
It passes false for endResponse parameter to suppress the internal call to Response.End
Use Server.Execute instead of Server.Transfer as the execution of code happens on the new page.
Here we will see how to implement three tier architecture(also known as n-tier architecture) in asp.net application.Three tier architecture is a well known architecture in software development and you can implement it in web based as well desktop applications.
Three tier architecture basically means dividing your project into three layers
1) User Interface Layer [UI] (Also known as Application Layer or Presentation Layer)
2) Business Access Layer [BAL] (Also known as Business Logic Layer)
3) Data Access Layer [DAL]
The advantage of this functionality is it makes a logical separation of components so if in near future we want to replace / change our database we need to change only data layer or if we need to change user interface we need to change only user interface layer and rest remains the same.
Continue reading 3-Tier Architecture In Asp.net Using C#.
Here we will see how to check for username availability using Jquery Ajax method in asp.net. In our website we normally keep the username unique and so it must be checked before saving the record that it has not been taken by any other user. We can do this validation on the submit button click or use OnTextChanged event but it is not so user friendly as the page gets Postback.
Following example demonstrates the same using Jquery Ajax method. Here while creating a user account he can check by making an Ajax call to asp.net [Web Method] at server side to get the availability of the username. It matches the user input against the database records and returns the text based on the availability. You can modified the code as per your requirements:
Continue reading Check Username Availability In Asp.net Using Jquery Ajax
Here we will see how to pass a datatable as parameter to stored procedure in C# using the sql server user defined table type. One of the way to speed up your application is to reduce the trips to your database especially by avoiding a call to stored procedure multiple times.
Table-valued parameters let you pass a collection of table rows as a parameter to your stored procedure. They allow passing entire sets of rows from ADO.Net code to SQL Server.
Below we will see the steps that needs to be followed to implement this functionality.
Continue reading Pass DataTable To Store Procedure Using Table Value Parameter.
Here we will see how to fill asp.net dropdownlist control with json data.
Code is as follows: Continue reading Fill Asp.Net DropDownList With Json Data (JQuery)
Here we will see how to block a user from performing CUT, COPY and PASTE operation on a particular textbox using jQuery. Sometimes it is required to disable the cut copy paste operation and make user mandatory to type the details.
The code is as follows: Continue reading Prevent Cut, Copy And Paste Operation For Text Box In Asp.Net Using Jquery.