Server respond with a status 403 (forbidden) - asp.net

I'm using asp.net MVC. I have hosted my website on appharbor. Everything is working fine on localhost. On live website I'm getting error.
Server responded with a status of 403 (Forbidden)
To solve this issue. I added <modules runAllManagedModulesForAllRequests="true" /> in web.config but it didn't work.
Another solution is I need to You need to change permissions on the folder bootstrap/css. To change permission I have to type command sudo chmod 0777. But I cannot figure out where to type this command.
So where I have to type this command or what is the alternative to tackle this 403 issue.

I know this is a little old, but I had the same problem now with jstree.
I don't know if you realized, but this behavior is given to you by the EnableOptimizations.
Basead on Denis Ivin answer here, you probably have a jstree folder inside Content/plugins and IIS, instead of giving you the jstree.css, is trying to list the folder and that is, by default, forbidden.
In my case I had to do the following for the plugin work as intended:
BundleConfig.cs
bundles.Add(new StyleBundle(
"~/Content/plugins/jstree/jstree")
.Include("~/Content/plugins/jstree/style.css"));
View.cshtml
#section css{
#Styles.Render("~/Content/plugins/jstree/jstree")
}

Related

I get a 404 NOT FOUND error when trying to use a ngrok server

I'm currently using webstorm to program my webpage and when I open it through Google chrome and host it locally, the url the browser uses is
http://localhost:63342/assignment2/statichtmlpage-edit.html?_ijt=nqejipcmjnaun1b1416leu6a2i
When I open Terminal in order to host it on ngrok, I type in ./ngrok http 63342
and then a window opens with the ngrok url that I can use
but when I go to that URL (http://4038e733.ngrok.io) all I get is a 404 NOT FOUND error.
I'm not sure why this is happening, any help would be appreciated
Access your page with the full URL:
http://4038e733.ngrok.io/assignment2/statichtmlpage-edit.html?_ijt=nqejipcmjnaun1b1416leu6a2i
Add your path to web (.html) files after the http://4038e733.ngrok.io/ page.
You were hosting from the root directory http://localhost:63342/, but forgot to point to a file. So as expected, the error:
GET / 404 Not Found
Is saying there is no file at the root directory.
I'd imagine the fix for most users is to append /index.html to the end of their ngrok link:
http://ngrok.io/ ... /index.html

convert .WAR for auto deploy in karaf/servicemix

I've got very simple .WAR containing example servlet. I'm able to deploy it in servicemix using the following command:
osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet
And then see it in my browser. But only with full path to a file, e.g.: localhost:8080/TestServlet/index.html or localhost:8080/TestServlet/TestServlet (my servlet is TestServlet class).
I'd like to launch the index.html page automatically after entering: localhost:8080/TestServlet
how to do it?
MORE IMPORTANT
I need a way to convert the .WAR file or servlet project (I've got the sources) so that new .WAR file can be auto-deployed by copying it to $SERVICEMIX_HOME/deploy directory.
I've tried editing the MANIFEST.MF file, but with no success. Probably I'm doing something wrong.
Thanks for any advice/help.
To be recognised as a wab, you need to add a context path header to your manifest:
Web-ContextPath: TestServlet
It's working now! I was doing my MANIFEST.MF according to this page: http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
The problem was that for some reason "Bundle-Version: 1.0" line was required as opposed to optional as stated on that page.
Honestly, just adding the Bundle-Version fix-it.
I knew it was something wrong with the MANIFEST.MF and after Holly Cummins' question I played with it a bit more. Thanks Holly.
I still can't do anything with the manual site launching (have to manually enter the index.html).
http://localhost:8080/TestServlet/ gives me this:
HTTP ERROR 404
Problem accessing /TestServlet/. Reason:
Not Found
Powered by Jetty://
http://localhost:8080/TestServlet/index.html gives me proper site.

classic asp server.transfer error

I have a file failed.asp in folder abc. Now i want to redirect my user.asp page in folder xyz to page failed.asp when there is a error. When i have my failed.asp in same folder as my user.asp it does not give me error but if i use virtual path in server.transfer it is giving me error. How can i fix this.
Server.Transfer("failed.asp") --Works
Server.Transfer("abc/failed.asp") or Server.Transfer("../abc/failed.asp") --fails saying error when loading file
does not work what is the possible work around for this issue.
Server.Transfer("/abc/failed.asp") should work. Note that the root path starts with a forward slash.

How do I edit the .htaccess file to point to a relative directory for a 404 error document?

Most htaccess 404 error rules are based on an absolute directory location, eg /404.php. I want one that is relative to the location it's placed in (so when I transfer from test environment in WAMP to live, I don't have to hope I edit the file right).
Unfortunately,
ErrorDocument 404 404Error.php
Just prints out 404Error.php to the browser, it doesn't call the actual error page like
ErrorDocument 404 /FOOBAR/404Error.php
does.
Edit:
I guess I wasn't clear enough. Test environment is a WAMP local server, with the error file at /FOOBAR/404Error.php while the 'live' server would be www.fubar.com/404error.php -- placing it in the root.
How's this?
ErrorDocument 404 ../directory/404page.html
RewriteBase /FOOBAR/
ErrorDocument 404 404Error.php
This works too, but Tycho's solution is a bit more elegant. Only use this one if you don't plan on using .htaccess for anything outside of /FOOBAR/ pretty much.

IIS giving 503 errors

I am running a Vista machine with IIS7. I believe (not 100% confident) IIS was working fine for me before I installed PHP from php-5.3.5-nts-Win32-VC9-x86.msi from official PHP website. I went ahead with the default install - did not cutomize anything. After the install, http://localhost gives me 503 Service Unavailable error. I have tried diagnosing using following links but can't find anything wrong. Please help me.
http://mvolo.com/blogs/serverside/archive/2006/10/19/Where-did-my-IIS7-server-go_3F00_-Troubleshooting-_2200_service-unavailable_2200_-errors.aspx
http://www.php.net/manual/en/install.windows.iis7.php
My apppools are running:
C:\Windows\System32\inetsrv>appcmd list apppools
APPPOOL "DefaultAppPool" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)
APPPOOL "Classic .NET AppPool" (MgdVersion:v2.0,MgdMode:Classic,state:Started)
I don't see any errors in either the Application Log or the System Log.
The CGI, ISAPI Extensions, ISAPI Filters are all checked as in http://www.php.net/manual/en/install.windows.iis7.php
also set following values in php.ini
fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0
following mapping is set in IIS:
Request path: *.php
Module: FastCgiModule
Executable: C:[Path to PHP installation]\php-cgi.exe
Name: PHP_via_FastCGI
C:\Windows\System32\inetsrv>appcmd list config -section:system.webServer/fastCgi
gives:
<system.webServer>
<fastCgi>
<application fullPath="C:\Program Files\PHP\php-cgi.exe" activityTimeout="60
0" requestTimeout="600" instanceMaxRequests="10000">
<environmentVariables>
<environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
<environmentVariable name="PHPRC" value="C:\Program Files\PHP\" />
</environmentVariables>
</application>
</fastCgi>
</system.webServer>
the solution provided here fixed the problem for me partly. It had nothing to do with PHP. I had added a url reservation sometime earlier when trying to experiment and self-host
some WCF services, and removing that url reservation solved the problem:
http://haacked.com/archive/2007/05/21/the-iis-7-team-rocks.aspx
netsh http show urlacl
The result showed that I had reserved http://+:80/ which takes precedence over all other URLs on port 80.
Reserved URL : http://+:80/
User: METAVERSE\Phil
Listen: Yes
Delegate: No
SDDL:
D:(A;;GX;;;S-1-5-21-1527697538-1582451445-1978546337-1000)
The solution was to run this command:
netsh http delete urlacl url=http://+:80/
Which removed the reservation.
My php scripts now run, but http://localhost/iisstart.htm is giving me a blank screen. Need to investigate it further...
The blank screen problem was fixed using this post: http://forums.iis.net/p/1158261/1906535.aspx
Control Panel->Programs and Features->Turn Windows features on/off->IIS->WWW Services->Common Http features->Static Content

Resources