Here I will explain how to solve the problem “the files use a different language which is not allowed since they need to be compiled together” when running web application using asp.net.Description:
In previous article I explained JQuery autocomplete text with webservice. During work with that sample I created WebService in both the languages C# and VB.NET and I placed both languages code behind files in App_Code folder and I tried to run the application at that time I got error like “the files use a different language which is not allowed since they need to be compiled together” as shown below
I got this error because of using different language (C#, VB.NET) webservice class files in same App_Code folder. To solve this problem we need to create separate folders for C# code and VB.NET Code files in App_Code folder and place the C# code files in one folder and VB.NET code files in another folder and need to add some code in web.config file.
First Create two folders under App_Code folder and give name as CSCode and VBCode and move AutoCompleteService.cs file inside of CSCode folder and WebService.vb inside of VBCode folder and add following code in web.config
If you observe above code I added codeSubDirectories relating to App_Code folder and directoryName will represent a sub folder of App_Code folder. Once we set these configurations in web.config each sub folder will compile separately and respective class files will save in CSCode and VBCode files. After add code run your application it will work for you.