Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

the files use a different language which is not allowed since they need to be compiled together

Aug 28, 2012
Introduction

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
<compilation debug="true">
<codeSubDirectories>
<add directoryName="CSCode"/>
<add directoryName="VBCode"/>
</codeSubDirectories>
</compilation>
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.

Happy Coding………

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Unknown said...

Thank you so much sir.. its working..

Anonymous said...

awesome!

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.