Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2007, 06:40 AM
Authorized User
 
Join Date: Aug 2006
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.
 
Old July 16th, 2007, 02:10 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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
 
Old July 17th, 2007, 07:04 AM
Authorized User
 
Join Date: Aug 2006
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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.