Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 16th, 2007, 06:40 AM
Authorized User
 
Join Date: Aug 2006
Location: delhi, delhi, India.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to KamalRaturi Send a message via Yahoo to KamalRaturi
Default Basic authentication

Hi,

I'm trying to include some user credentials for accessing a remote
file (XML File).It can be accesed by dll'method at remote location . The remote location requires that I use Basic authentication. I tried using following code but when code execution comes at highlighted line it breaks itself and nothing happens.


CODE:
__________________________________________________ ______
  Dim xmlDoc As XmlDocument = New XmlDocument
        Dim request As HttpWebRequest = CType(WebRequest.Create("http://www.abc.ds/scripts/web.dll"), HttpWebRequest)

        'Set Request Method (POST) and Content Type (text/xml)
        request.Method = "POST"
        request.ContentType = "text/xml"
        request.ContentLength = 100000
        request.Credentials = New System.Net.NetworkCredential("Username", "pwd")

        request.Timeout = 15000
        Dim str As Stream = Nothing
        Dim resp As WebResponse = request.GetResponse() str = resp.GetResponseStream()

        'Process Response
        ' Get Response into String
        Dim sr As StreamReader = New StreamReader(str)
        xmlDoc.LoadXml(sr.ReadToEnd())
        'label1.text = xmlDoc.InnerXml
        sr.Close()
        str.Close()

__________________________________________

Can anyone help?

Thanks in Advance.
  #2 (permalink)  
Old July 16th, 2007, 02:10 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What is the "web.dll" file? Is this a .NET assembly?

Usually, you would make a web request to a page or web service. Please tell us more about what the target handler is for this request.

-Peter
  #3 (permalink)  
Old July 17th, 2007, 07:04 AM
Authorized User
 
Join Date: Aug 2006
Location: delhi, delhi, India.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to KamalRaturi Send a message via Yahoo to KamalRaturi
Default

Thanks planoie,

I got the error in my Code. Its in Url.

Now it is working fine.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS Basic authentication problem -401 Unauthorized bruceaflash BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 14th, 2005 08:28 AM
How to avoid a Basic Authentication popup via link snorre70 HTML Code Clinic 1 July 30th, 2004 06:34 AM
chapter 20 basic authentication egivler BOOK: Beginning ASP.NET 1.0 3 June 29th, 2004 09:16 PM
Authentication dbradley ASP.NET 1.0 and 1.1 Basics 2 August 13th, 2003 10:17 PM



All times are GMT -4. The time now is 04:06 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.