Archive for the ‘ASP.NET’ Category

How to compile .NET Core Console Application as .exe File?

November 3, 2020 Leave a comment

When you compile .NET Core Console Application it will generate DLL file instead of exe file for the build project.

NET Core 3.0+ projects will now include an executable file for the platform you build on by default. This is just an executable and your main logic is still inside a .dll file.

But .NET Core 3.0 also introduced single-file deployments so deploying with

dotnet publish -r win-x64 -p:PublishSingleFile=True --self-contained false

will create a single .exe file containing all your dependencies. You can change --self-contained to true to also include the .NET Core Runtime as well so .NET Core does not need to be installed globally on the target machine.

You can also do this from Visual Studio Publish

.NET Core Publish

Hope it helps!

Define Composite Key in Model.(Core, EF Code First)

When there are composite keys in database table and when you try to put data annotation it will throw below error

Entity type ‘Orgmember’ has composite primary key defined with data annotations. To set composite primary key, use fluent API

The above code will not work and throw an error

Here is the solution for this problem

Step 1: Modify your modal class like

Step 2: Use the fluent API to set up a composite key.

Hope it helps!

How to remove x from Internet Explorer ?

How to remove X from IE input box, Here is the css we can write to remove x.

/* clears the ‘X’ from Internet Explorer */
input[type=search]::-ms-clear { display: none; width : 0; height: 0; }
input[type=search]::-ms-reveal { display: none; width : 0; height: 0; }


/* clears the ‘X’ from Chrome */

input[type=”search”]::-webkit-search-results-decoration { display: none; }


Categories: ASP.NET Tags: , ,

Load XML from URL giving an error (The remote server returned an error: (401) Unauthorized.)

November 1, 2018 Leave a comment

If you are getting a 401 Unauthorized error while reading an XML from URL, here is the solution you can try


Hope this help!

Categories: ASP.NET Tags: , ,

Error :(System.Web.UI.HtmlControls.HtmlIframe) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl) in VS2017

Reason for the above error is I have my project in .NET framework 3.5 and I update it to .NET framework 4.5,

Solution for the above error is:
We need to change the *.designer.cs file reference from:




Categories: ASP.NET

MySQL : The user specified as a definer (‘root’@’%’) does not exist

This error occurs when exporting views/triggers/procedures from one database or server to another as the user that created that object no longer exists.

So here are the solutions:

  • Change DEFINERCreate the missing user
  • Create the missing user

or simply run following query

grant all on *.* to ‘root’@’%’ identified by ‘password’ with grant option;

Hope it helps.

Categories: ASP.NET

MySQL : The host localhost does not support SSL connections

When I moved database MySql.Data 7.0.7 to 8.0.8. I got following error

The host localhost does not support SSL connections.

So, here is the solution for this error ,Just add SslMode=none in connection string

server=localhost;user id=roor;password=xyz;persistsecurityinfo=True;port=123;database=TestDB; SslMode=none

Hope it helps !

Categories: ASP.NET, Sql Server

How to Add space and increase width of Morris.Js Bar?

There are two properties of Morris.Js bar we can use to achieve this
1) barGap
2) barSizeRatio

barGap is an integer that sets the space between bars in a single bar group.
Default is 3.
Increase this value to space them further, decrease it to bring them closer.

barSizeRatio is the proportion of the width of the entire graph given to bars. Defaults to 0.75.
Increase the number closer to 1 to make the bars wider, if its =1 the bars will take up the entire graph, if its > 1 bars will overlap.

Here is an example of code

element: ‘bar-chart’,
data: [
{ y: ‘Apr’, a: 75, b: 60, c: 5, d: 50 },
{ y: ‘May’, a: 180, b: 220, c: 140, d: 160 },
{ y: ‘June’, a: 420, b: 340, c: 350, d: 270 }
xkey: ‘y’,
ykeys: [‘a’, ‘b’, ‘c’, ‘d’],
labels: [‘A’, ‘B’, ‘C’, ‘D’],
barColors: [‘#0B62A4′,’#f75b68′,’#4DA74D’,’#646464′],
hideHover: ‘auto’

Hope it helps!

Categories: ASP.NET Tags: , , ,

How to fix function is ambiguous in the namespace ‘system’ compiler error

When you are upgrading your project framework its possible that old version of DLL reference still exists , to remove that follow the below steps

-Open Object Explorer in Visual Studio
-Find that function
-Find the function/dll which has old reference and delete it

Hope it helps!

Categories: ASP.NET

Call Repeater ItemCommand event manually from outside the repeater

February 6, 2018 Leave a comment

Following is the code to call repeater item command event manually

Private Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click

For i = 0 To rptPlayers.Items.Count – 1

Dim tItem As RepeaterItem = rptPlayers.Items(i)

Dim tButton As ImageButton = ptPlayers.Items(i).FindControl(“imgAdd”)

Dim tEvents As New System.Web.UI.WebControls.CommandEventArgs(tButton.CommandName, tButton.CommandArgument)

Dim rpt As New RepeaterCommandEventArgs(tItem, tButton, tEvents)

rptPlayers_ItemCommand(tButton, rpt)


End Sub

Categories: ASP.NET