mte01
asked on
.htaccess (403) Forbidden vb.net file download
hi
i try to download a file from the server, the folder that withhold the file contain this file: .htaccess
inside of it there is: deny from all
im trying to access this folder using this code:
Try
Dim proxyObject As WebProxy = New WebProxy(url, True)
Dim objRequest As WebRequest = System.Net.HttpWebRequest. Create(url )
objRequest.Proxy = proxyObject
Dim ws As HttpWebResponse = CType(objRequest.GetRespon se(), HttpWebResponse)
Dim str As Stream = ws.GetResponseStream()
................
................
this is returning the exception:
The remote server returned an error: (403) Forbidden.
is there a way to download the file without having to remove the .htaccess ???
thanks in advcance
i try to download a file from the server, the folder that withhold the file contain this file: .htaccess
inside of it there is: deny from all
im trying to access this folder using this code:
Try
Dim proxyObject As WebProxy = New WebProxy(url, True)
Dim objRequest As WebRequest = System.Net.HttpWebRequest.
objRequest.Proxy = proxyObject
Dim ws As HttpWebResponse = CType(objRequest.GetRespon
Dim str As Stream = ws.GetResponseStream()
................
................
this is returning the exception:
The remote server returned an error: (403) Forbidden.
is there a way to download the file without having to remove the .htaccess ???
thanks in advcance
ASKER
Hi Tim
humm not cool :(
can i change the .htaccess file in such way that only my .net application can access the folder?
Best
humm not cool :(
can i change the .htaccess file in such way that only my .net application can access the folder?
Best
ASKER
Note that I have control over this .htaccess file, and what I want is to change it so that it allows only my .net application to access this folder..any help on that??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry Tim, but this didnt work, when i tried the call the url from explorer i got this error:
" Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log. "
when i tried it from my vb.net application i got this exception:
" The remote server returned an error: (500) Internal Server Error. "
i have changed the
RewriteRule \.xxx$ - [F] to RewriteRule \.exe$ - [F]
and i kept this line as it is for i dont know which domain shall i put:
objRequest.Referer = "SomeSpecificDomain.Com"
thanks for the help
" Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log. "
when i tried it from my vb.net application i got this exception:
" The remote server returned an error: (500) Internal Server Error. "
i have changed the
RewriteRule \.xxx$ - [F] to RewriteRule \.exe$ - [F]
and i kept this line as it is for i dont know which domain shall i put:
objRequest.Referer = "SomeSpecificDomain.Com"
thanks for the help
mte01,
It may be that this is actually because it is working and the settings are not quite right.
I have given you objRequest.Referer="SomeSp ecificDoma in.Com" but in .htaccess the condition includes http:// as well so we need to modify one or the other.
Try it with
objRequest.Referer="http://SomeSpecificDomain.com"
If it works then your app will be fine as it is passing in the same referer as the .htaccess file is expecting but anyone else who will not have that same referer value will get a failure page as you have done.
Tim
It may be that this is actually because it is working and the settings are not quite right.
I have given you objRequest.Referer="SomeSp
Try it with
objRequest.Referer="http://SomeSpecificDomain.com"
If it works then your app will be fine as it is passing in the same referer as the .htaccess file is expecting but anyone else who will not have that same referer value will get a failure page as you have done.
Tim
ASKER
Tim,
Actually the problem is that I don't know what I should place instead of this SomeSpecifcDomain.com in the case of my application.
Actually the problem is that I don't know what I should place instead of this SomeSpecifcDomain.com in the case of my application.
ASKER
I figured out now that it can be anything as long as it's the same on both sides, I tried your latest suggestion, and it also didn't work....
ASKER
I solved it using another way...thanks for your help!
Simply put, NO.
The .htaccess file determines who can access what files within the folder and do what with them. If it is set to deny from all then there is nothing you can do with it.
Tim Cottee