Sign in to follow this  
ferr

[web] Getting a 403 when trying to access .cs (C#) files

Recommended Posts

ferr    194
I've been using Apache and DynDns for years now, and to the best of my knowledge I have always had access to my .cs files until just recently when I purchased a Linksys wireless router. Now I'm getting this,
Quote:
Forbidden You don't have permission to access /CSProg/Program.cs on this server. Apache/2.0.52 (Win32) Server at mywebsite.cx Port 80
If I change the file extension from .cs to .cpp it accesses it and reads it properly, but I have hundreds of .cs files and don't want to do that for all of them. What can I do to allow .cs access? I've looked throughout my router firmware as well as some Apache config files for anything relevant to .cs or C# and could not find anything. edit: I've tested this in the latest Firefox and in IE7, so it doesn't appear to be a browser issue, if that's even possible.

Share this post


Link to post
Share on other sites
Michalson    1657
My guess:

Your router setup now shows you as being an external visitor. You thus no longer have access permissions to view site source code (I assume you have mono installed or Apache is configured to see .cs as source files)

Share this post


Link to post
Share on other sites
ferr    194
I do have the version of Apache that is compatible with ASP.Net, but I've had that for about 6 months now. That is a good guess, it must be reading the .cs file as an asp source code file.. now to figure out how to get around that.

This is what the ASP module looks like in the config file:
Quote:
LoadModule aspdotnet_module modules/mod_aspdotnet.so

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo

AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"

<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>

I guess I could remove csproj and cs.. but then ASP wouldn't work.. or would it. ASP's not a huge priority right now, though.

edit solution: Fantastic, that did work after changing those to cshproj and csh.

Share this post


Link to post
Share on other sites
ferr    194
Quote:
Original post by Alpha_ProgDes
what's the difference between cs and csh? or is that a Linksys thing (as in actually documented reason for doing that)?

csh is just a temporary extension for C# (note: CSHarp).

What that means is, when apache tries to protect ASP.net's source code (which should pretty much always be .cs if you're doing it with C#) it will try to deny access to .csh files on the server instead of .cs files. At least I hope that's all apache needs the info for.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this