Does ASP.NET support C++?

佐手、 提交于 2019-12-22 04:48:07

问题


When I go to New -> Web site, in the drop-down menu "Language" there are only 2 languages: Visual C# and Visual Basic. No Visual C++. Maybe, I'm using wrong version of Visual Studio? (mine is 9.0.21022)
I tried to google this problem. I found a topic which tells that using C++ in ASP.NET is impossible. But it was posted in 2002 and I hope that something has changed since that year. Is it possible to write ASP.NET applications using C++? If it does, can I use visual designer with this language?


回答1:


Visual Studio generates C# and VB code and that's why it provides you only those options, because the visual designers from which code is generated don't understand C++. There's nothing preventing you from creating a C++ project that uses the managed .NET codebase like the System, System.Web.* namespaces, etc. You won't have the designers or code generators working for you, which means comparatively more coding for you; however arguably a C++ programmer is accustomed to not having a lot of visual design support.

Microsoft provides information about ways of programming .NET using C++.

The caveat is you might not be able to use the version of Visual Studio you wanted to use. Worst case scenario is you use a text editor and invoke the compiler from the command-line.




回答2:


It is possible to use Managed C++ to create classes for ASP.NET pages, but at this time (through VS2008) there isn't explicit support for coupled source files or design-time integration. Only VB.NET and C# have full support.

If you're interested in building applications that only use handlers, you can write your handler classes in a separate library project or assembly and then just import them into an empty ASP.NET project. Any language that may be used to produce a .NET assembly will work in this case.

The following links can get you started if you wish to give it a shot. The only real restriction for using any language with ASP.NET is whether the code is available as a .NET assembly.

ASP.NET with Managed C++ @ CodeProject
The ASP Column: Code-behind in ASPX Files @ MSDN



来源:https://stackoverflow.com/questions/1615215/does-asp-net-support-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!