403 forbidden error

J

Jay

have some methods(signIn()) in MyService.dll, that I use from my webpage.

SignIn()
{
requestCommand =
(HttpWebRequest)WebRequest.Create(http://myserver/cwa/MainCommandHandler.ashx);


requestCommand.GetRequestStream() --This call returns me "403 forbidden"
error.

}


Any idea what is causing that?
The same code works on my box. When I move it to the server, it fails.
 
G

George Ter-Saakov

Sounds like you are behind proxy server. And most likely proxy is using NT
authentication since you are not prompted for username/password.

check your IE settings, Connection tab.

You will actually need to add folowing code if it's true.
WebProxy pr = new WebProxy(http://proxyip:proxyport);

pr.Credentials = new NetworkCredential("userid", "pwd", "domain");

request.Proxy = pr;

request.Credentials = new NetworkCredential("userid", "pwd", "domain");


George.
 
J

Jay

Thanks for your response. I tried the following it did NOT work.
This is what I tried.

On my box: I have the proxy server specified in my internet options->LAN
settings. "Proxy.mycompany.com:80"
The app runs on my box - No problem.

When I changed the app to specify the "network credentials" - it did NOT
work on my own box.

On the server: No proxy was specified earlier. I was NOT able to access the
internet.
Now I specified the proxy. I am now able to access internet - which tells me
that the proxy settings are working.
Now I put my on the server:
1. with out network credentials - did NOT work.
2. with Network credentials - did NOT work..

Sounds like we are going on the right track...but something else is
missing..
Please help!
 
G

George Ter-Saakov

My guesses.

1. You specified incorrect domain name. It must be full name.
Go to My Computer/Properties/Computer name and Domain filed must be matching
what you've specified

2. Can you access internet on a server using browser? May be it's closed
off by firewall or something?

3. Your proxy not using NTLM authentication but it's using basic.
Then try to do folowing

string sProxySupport = "Basic " + Convert.ToBase64String(new
System.Text.UTF8Encoding().GetBytes("user:password"));
Request.Headers["Authorization"] = sProxySupport;


George
 
J

Jay

1. Did you mean The Domain of the computer or domain of the account that I
am trying to login?
Well, I tried both. They did not work.

2. I can access the intranet and also internet from the server.

3. I tried this one too. did not work.

George Ter-Saakov said:
My guesses.

1. You specified incorrect domain name. It must be full name.
Go to My Computer/Properties/Computer name and Domain filed must be
matching what you've specified

2. Can you access internet on a server using browser? May be it's closed
off by firewall or something?

3. Your proxy not using NTLM authentication but it's using basic.
Then try to do folowing

string sProxySupport = "Basic " + Convert.ToBase64String(new
System.Text.UTF8Encoding().GetBytes("user:password"));
Request.Headers["Authorization"] = sProxySupport;


George

Jay said:
Thanks for your response. I tried the following it did NOT work.
This is what I tried.

On my box: I have the proxy server specified in my internet options->LAN
settings. "Proxy.mycompany.com:80"
The app runs on my box - No problem.

When I changed the app to specify the "network credentials" - it did NOT
work on my own box.

On the server: No proxy was specified earlier. I was NOT able to access
the internet.
Now I specified the proxy. I am now able to access internet - which tells
me that the proxy settings are working.
Now I put my on the server:
1. with out network credentials - did NOT work.
2. with Network credentials - did NOT work..

Sounds like we are going on the right track...but something else is
missing..
Please help!
 
G

George Ter-Saakov

Well, I am out of suggestions :)

George


Jay said:
1. Did you mean The Domain of the computer or domain of the account that I
am trying to login?
Well, I tried both. They did not work.

2. I can access the intranet and also internet from the server.

3. I tried this one too. did not work.

George Ter-Saakov said:
My guesses.

1. You specified incorrect domain name. It must be full name.
Go to My Computer/Properties/Computer name and Domain filed must be
matching what you've specified

2. Can you access internet on a server using browser? May be it's closed
off by firewall or something?

3. Your proxy not using NTLM authentication but it's using basic.
Then try to do folowing

string sProxySupport = "Basic " + Convert.ToBase64String(new
System.Text.UTF8Encoding().GetBytes("user:password"));
Request.Headers["Authorization"] = sProxySupport;


George

Jay said:
Thanks for your response. I tried the following it did NOT work.
This is what I tried.

On my box: I have the proxy server specified in my internet options->LAN
settings. "Proxy.mycompany.com:80"
The app runs on my box - No problem.

When I changed the app to specify the "network credentials" - it did NOT
work on my own box.

On the server: No proxy was specified earlier. I was NOT able to access
the internet.
Now I specified the proxy. I am now able to access internet - which
tells me that the proxy settings are working.
Now I put my on the server:
1. with out network credentials - did NOT work.
2. with Network credentials - did NOT work..

Sounds like we are going on the right track...but something else is
missing..
Please help!


Sounds like you are behind proxy server. And most likely proxy is using
NT authentication since you are not prompted for username/password.

check your IE settings, Connection tab.

You will actually need to add folowing code if it's true.
WebProxy pr = new WebProxy(http://proxyip:proxyport);

pr.Credentials = new NetworkCredential("userid", "pwd", "domain");

request.Proxy = pr;

request.Credentials = new NetworkCredential("userid", "pwd", "domain");


George.


have some methods(signIn()) in MyService.dll, that I use from my
webpage.

SignIn()
{
requestCommand =
(HttpWebRequest)WebRequest.Create(http://myserver/cwa/MainCommandHandler.ashx);


requestCommand.GetRequestStream() --This call returns me "403
forbidden"
error.

}


Any idea what is causing that?
The same code works on my box. When I move it to the server, it
fails.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top