如何在asp.net中隐藏.cs文件的源代码

编程入门 行业动态 更新时间:2024-10-24 10:20:32
本文介绍了如何在asp中隐藏.cs文件的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我想在asp中隐藏.cs(App_Code文件夹中的类文件)文件的源代码.我可以创建类的.dll文件,但问题是它在NameSpace

Hi All, I want to hide my source code of .cs(Class File in App_Code Folder) file in asp.i can create the .dll file of classes but the problem is that it show error on the NameSpace

using System.Web.Security; using System.Web.UI;

并且我在类文件的方法中在类文件中添加了asp控件的引用(例如GridView,TextBox,DropDownList)等. 因此,由于这个原因,我无法创建.dll文件 所以请建议我. 在此先感谢.

and i have add the reference of asp Controls in class file(e.g GridView,TextBox,DropDownList) etc in the methods of class file. so due to this i am not able to create the .dll file so please suggest me. Thanks in Advance.

推荐答案

首先,您需要在cs文件中编写代码.称为背后的代码. 其次,将您的代码构建到dll中.为Web应用程序创建一个新的安装项目. 在以下项目中选择Web应用程序:Web应用程序的主要输出Web应用程序的本地化资源Web应用程序的内容文件Web应用程序的文档文件构建您的安装项目. 将Web应用程序安装在与调试机器不同的新位置.新的可视文件夹将包括.aspx,但不包括.cs文件. 这样可以保护您的代码. 希望对您有所帮助. First, you need write you code in cs file. Which is called code behind. Second, build you code in to a dll. Create a new setup project for web application. Select you web application on follow items: Primary output from your web app Localized resources from your web app Contents files from your web app Documentation files from your web app Build you setup project. Install your web application in a new place which different from you debuging machine. The new visual folder will include .aspx but not .cs file. This way can protect your code. Hope this help you.

执行以下操作:开发一些ASP.NET应用程序并使之运行;它甚至可以是您的开发计算机.从客户端,通过Web浏览器访问您的应用程序.加载页面后,请使用查看页面源代码"并查看其中的内容.您看到"* .cs"文件的任何迹象吗?不是吗? 如果您期望得到一些,则不知道ASP.NET是如何工作的.客户端上从来没有任何服务器端代码.服务器端会生成常规的HTML页面(以及类似的其他资源; PDF,图片等),并以HTTP响应的形式发送它们.请参见 www.asp/ [ ^ ].
—SA
Do the following: Develop some ASP.NET application and make it running; it can be even of your development computer. From the client side, access your application throw the Web browser. When a page is loaded, use "View Page Source" and see what''s inside. Do you see any sign of "*.cs" file? No? If you expected some, you had no idea how ASP.NET works. There is no any of server-side code on the client side, ever. Server-side generates regular HTML pages (and other resources like that; PDFs, pictures, etc.) and deliver them in HTTP response. See www.asp/[^].
—SA

创建项目时可以建立asp网站(非应用程序),则无需担心.dll文件和Web页面将正常运行. You can build asp website(not application) when create a project,then you donot need to worry about .dll files,and the web page will run fine.

更多推荐

如何在asp.net中隐藏.cs文件的源代码

本文发布于:2023-11-03 15:50:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555495.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:源代码   文件   如何在   net   asp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!