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

Started by
3 comments, last by ferr 17 years, 4 months ago
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.
Advertisement
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)
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.
what's the difference between cs and csh? or is that a Linksys thing (as in actually documented reason for doing that)?

Beginner in Game Development?  Read here. And read here.

 

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.

This topic is closed to new replies.

Advertisement