开发者

Adding C# Web Form to VB Web Application

开发者 https://www.devze.com 2023-02-12 03:35 出处:网络
Is there any way to add a C# Web Form to an ASP.NET 4.0 Web Application that is written in VB.NET? I had an ASP.NET 2.0 WEB SITE that I recently converted to an ASP.NET 4.0 WEB APPLICATION. It was mos

Is there any way to add a C# Web Form to an ASP.NET 4.0 Web Application that is written in VB.NET? I had an ASP.NET 2.0 WEB SITE that I recently converted to an ASP.NET 4.0 WEB APPLICATION. It was mostly written in VB.NET with a couple pages that had C# code behinds.

I've read the following article (the end section about mulitple languages):

http://msdn.microsoft.com/en-us/library/t990ks23.aspx

But it does not seem to help for the following two reasons

1) When I converted my site to an application, it didn't seem to add an APP_CODE folder at all 2) I'm not looking to just write a simple class, I actually want to be able to add a WEB FORM with a C# code behind

When I try to add a new item and I select which type of item I want to add, I am only given to option to add a VISUAL BASIC web form.

I have a workaround right now. If I need a new web form with a C# code behind, I take one of my old C# web forms and just copy and paste the form and C# code behind into the project and then rename it and change the class name as well. Then i make my changes and do what I need to do. It seems to work, but I was just wondering if there was an easier way.

You might wonder why want to put C# forms in my VB app. I wrote my app in VB (not well versed in C# but I can read it). I have a programmer working for me that is much more开发者_运维知识库 efficient with C#. I don't really have the budget to spend weeks/months getting her up to speed with VB


Can you put the C sharp web forms in another class library as user controls then just reference and drop them on the pages?

You can reference the assembly in the web config to use in all pages

http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号