If a folder does not exist, create it

As others have said, use System.IO.Directory.CreateDirectory. But, you don’t need to check if it exists first. From the documentation: Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. If the directory already exists, this method does not create a new directory, but it returns a … Read more

entity object cannot be referenced by multiple instances of IEntityChangeTracker. while adding related objects to entity in Entity Framework 4.1

Because these two lines … … don’t take a parameter in the constructor, I guess that you create a context within the classes. When you load the city1… …you attach the city1 to the context in CityService. Later you add a city1 as a reference to the new Employee e1 and add e1 including this reference to city1 to the context in EmployeeService. As a result you have city1 attached to … Read more

System.ComponentModel.Win32Exception: Access is denied Error

Make sure your application pool identity account on your server has permissions to start that service. It works on your ASP.NET Development Server because it runs under your user account (admin) In a default IIS configuration, this account is Network service or ApplicationPoolIdentity (depending on IIS version) and usually cannot manage services. So, change the … Read more

TypeError: $(…).DataTable is not a function

CAUSE There could be multiple reasons for this error. jQuery DataTables library is missing. jQuery library is loaded after jQuery DataTables. Multiple versions of jQuery library is loaded. SOLUTION Include only one version of jQuery library version 1.7 or newer before jQuery DataTables. For example: See jQuery DataTables: Common JavaScript console errors for more information … Read more

The following sections have been defined but have not been rendered for the layout page “~/Views/Shared/_Layout.cshtml”: “Scripts”

It means that you have defined a section in your master Layout.cshtml, but you have not included anything for that section in your View. If your _Layout.cshtml has something like this: Then all Views that use that Layout must include a @section with the same name (even if the contents of the section are empty): As an alternative, you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)