Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to protect my files page.aspx.cs

Posted on 2005-04-21
7
Medium Priority
?
754 Views
Last Modified: 2008-01-16
Hi

 Is there a way to protect my files page.aspx.cs from users to see its content?

Thanks in advance
0
Comment
Question by:negreteo
6 Comments
 
LVL 15

Expert Comment

by:praneetha
ID: 13836310
users cannot see .cs files....
0
 
LVL 12

Expert Comment

by:laotzi2000
ID: 13836313
page.aspx.cs is needed when deployed, it is compiled into the dll under directory bin
0
 
LVL 18

Accepted Solution

by:
tusharashah earned 2000 total points
ID: 13836320
just dont Upload it on the server...

Your CS file are compiled to DLL files in Bin directory.. so whenever you upload your file to hosting server or your Production Server you dont need to include them...

-tushar
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:praneetha
ID: 13836332
when user makes a req for cs file it throws an error

 Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cs' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 13836334
it is by default protected from browsing:

inside your machine config:

<httpHandlers>
                  <add verb="*" path="*.vjsproj" type="System.Web.HttpForbiddenHandler"/><add verb="*" path="*.java" type="System.Web.HttpForbiddenHandler"/><add verb="*" path="*.jsl" type="System.Web.HttpForbiddenHandler"/><add verb="*" path="trace.axd" type="System.Web.Handlers.TraceHandler"/>
                  <add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/>
                  <add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory"/>
                  <add verb="*" path="*.asmx" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
                  <add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/>
                  <add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/>
                  <add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="GET,HEAD" path="*.dll.config" type="System.Web.StaticFileHandler"/>
                  <add verb="GET,HEAD" path="*.exe.config" type="System.Web.StaticFileHandler"/>
                  <add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.csproj" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.vb" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.vbproj" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.webinfo" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.asp" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.licx" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.resx" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="*" path="*.resources" type="System.Web.HttpForbiddenHandler"/>
                  <add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler"/>
                  <add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler"/>
            </httpHandlers>


and since the .cs is mapped to the asp_net.dll , anyone trying to view your code behind files will be processed by the ForbiddenHandler

0
 
LVL 12

Expert Comment

by:laotzi2000
ID: 13836700
type error:
page.aspx.cs is not necessary for deployment, so you don't need to put it on
the web server at all.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question