如何在asp.net中隐藏.cs文件的源代码 [英] How to hide sourcecode of .cs file in asp.net

查看:85
本文介绍了如何在asp.net中隐藏.cs文件的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我想在asp.net中隐藏.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.net.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.net控件的引用(例如GridView,TextBox,DropDownList)等.
因此,由于这个原因,我无法创建.dll文件
所以请建议我.
在此先感谢.



and i have add the reference of asp.net 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响应的形式发送它们.请参见 http://www.asp.net/ [ ^ ].

—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 http://www.asp.net/[^].

—SA


创建项目时可以建立asp.net网站(非应用程序),则无需担心.dll文件和Web页面将正常运行.
You can build asp.net 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文件的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆