473,783 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpWebRequest is giving: "Error on HTTP request: The remote server returned an error: (403) Forbidden."

I am migrating working code (HTTPRequest with Authentication) from vb
to vb.net

vb:
Set objXMLHTTPServe r = New MSXML2.XMLHTTP3 0
objXMLHTTPServe r.Open strMethod, strGetRequest, False, "UserId",
"Password"
objXMLHTTPServe r.setRequestHea der "Content-Type",
"applicatio n/x-www-form-urlencoded"
....
objXMLHTTPServe r.send (varPostData)

is getting data from our clients without a problem, similar code in
..net:

Dim req As HttpWebRequest
req = CType(WebReques t.Create(strURL ), HttpWebRequest)
req.Credentials = New System.Net.Netw orkCredential(" UserId",
"Password")
req.ContentType = "applicatio n/x-www-form-urlencoded"
....
dim funSendHTTPRequ est as WebResponse = req.GetResponse ()

giving "Error on HTTP request: The remote server returned an error:
(403) Forbidden."

What am i missing?
Any help is appreciated.

Nov 19 '05 #1
2 5688
failed authenication is a 401, 403 is a forbidden url (usually a browse
directory request). check that the url is correct, also what did you set the
Method to?

-- bruce (sqlwork.com)

<ed******@yahoo .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I am migrating working code (HTTPRequest with Authentication) from vb
to vb.net

vb:
Set objXMLHTTPServe r = New MSXML2.XMLHTTP3 0
objXMLHTTPServe r.Open strMethod, strGetRequest, False, "UserId",
"Password"
objXMLHTTPServe r.setRequestHea der "Content-Type",
"applicatio n/x-www-form-urlencoded"
...
objXMLHTTPServe r.send (varPostData)

is getting data from our clients without a problem, similar code in
.net:

Dim req As HttpWebRequest
req = CType(WebReques t.Create(strURL ), HttpWebRequest)
req.Credentials = New System.Net.Netw orkCredential(" UserId",
"Password")
req.ContentType = "applicatio n/x-www-form-urlencoded"
...
dim funSendHTTPRequ est as WebResponse = req.GetResponse ()

giving "Error on HTTP request: The remote server returned an error:
(403) Forbidden."

What am i missing?
Any help is appreciated.

Nov 19 '05 #2
Method is post.
I did not put all the code that’s irrelevant,
Code works with get a post; I’ve tested it with few other sides that do
not require
authentication.
URL is correct; I am using the same one that is working from vb 6
without a problem for a few years now.
The problem is in .net authentication, am I using proper statement
req.Credentials = New System.Net.Netw orkCredential(" IAA", "IAA")
and is their anything else I should do?

Thanks in advance.
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
7382
by: Lakshmi Narayanan.R | last post by:
Hi Experts, Using keyword "To" in select case giving error.The following code is got from www.microsrosoft.com itself. What is the wrong with this?. <% Dim Number1 Number1 = 7 ' Initialize variable. Select Case Number1 ' Evaluate Number1. Case 1 To 5 ' Number1 between 1 and 5, inclusive.
0
18460
by: BGS | last post by:
I have a web site (www.on-the-matrix.com) that displays photos in a "slide show" format on ASPX pages that run in an inline frame on an ASP page (or in a separate pop-up window). The ASPX pages use a hidden form to transmit information back to the server so it will know which is the next photo to load. All of this works as intended in modern versions of Internet Explorer, Netscape and Mozilla. With Opera, however, users receive a...
2
8757
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking binary code; code not accessible). I send XML requests to it. If my request is accepted, ServerXMLHTTP returns XML with accept details. If my request is rejected, ServerXMLHTTP returns XML with reject details.
4
6882
by: Rachel McConnell | last post by:
Hello, I have a Java web application using Hibernate to connect to a PostgreSQL backend. I am seeing the below stack trace during processing of a set of data consisting of around 1000 objects; for a 200 object set I don't see the exception. I believe the salient point is the Out Of Memory bit - marked below by *****'s The fact that this exception occurs during a call to
23
5141
by: deathtospam | last post by:
A day or two ago, I wrote a quick ASPX page with a CS codebehind using Visual Studio .NET 2005 -- it worked, I saved it and closed the project. Today, I came back to the project, reopened the solution, and was greeted with the following error: ======================================================================== It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error...
2
4085
by: bepnewt | last post by:
Hello! I'm trying to connect to different sites using an HttpWebRequest object and some of them return an Error 400. If you navigate to it in a normal browser, it works fine. This is an example of one: http://www.nmprc.state.nm.us Error: The remote server returned an error: (400) Bad Request.
13
4777
by: Kevin Liebowicz | last post by:
Yes, I wasted the past two days trying to fix this. Yes, this is on a Win2003 Server. Yes, this machine is a domain controller. Yes, I seen the dozens of KB articles like this one: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q315158 But the problem is that 99% of these are for ASP .NET 1.x and this is .NET 2.x which I just installed to try and get .net working for the first time ever. I've see all the HACKS to get .net 1.x...
1
1471
by: Rahul Bhate | last post by:
Hello Sir My problem is in dos giving error that javac is not recognised.Tell me the steps for debugging.I have already set the CLASSPTH through command line & also set the PATH.But still giving error.Java is installed in the foolowing path->> C:\Program Files\jdk1.5 I have already set the following classpath in xp (start->Settings->control Panel->system->Environment Variable->click on new button->variable name:CLASSPATH and Variable Value as:...
4
1840
by: mukeshrasm | last post by:
<?php // create new document pdf_new(); $pdf = pdf_new(); pdf_open_file($pdf); pdf_begin_page($pdf, 500, 700); // define a font $font = pdf_findfont($pdf, "Courier", "host", 0);
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.