spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column113


JScript .NET, Part VII: Consuming add from ASP.NET

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Defining A Virtual Directory

We have showed you how to consume Web services from DHTML pages in Columns 97, 98, 99, 105, and 106. Consuming Web services from ASP.NET pages is not as straightforward as from DHTML pages, but it is not that complicated either.

The first new concept you have to deal with is the proxy. ASP.NET pages cannot interact directly with Web services. You need to create a proxy for the Web service you want to consume in your ASP.NET code. A proxy is a special component that masquerades as the service. The proxy insulates you from the location of the actual service. The location is captured once, when the proxy is created, and from then on you don't have to worry about where the Web service is. Creating a proxy for a Web service converts the Web service to a local component. In general, when you want to call a local component from your code, you need to access the component's class definition including its namespace, as well as its binary realization in the form of a dll. That's exactly what you get when you create a proxy for a Web service:

  • Namespace and class definition
  • A library (.dll) file

Before showing you how to create proxies, there is a security issue you need to be aware of. Once you create a proxy, you are left with a dll file. This library resides in a certain directory and is not known in other directories. You need to create this library in the same directory where you develop your ASP.NET pages. As we will show later in this column, your IIS Web server needs to have access to these pages. Therefore, you must make sure the directory you develop in is accessible by everyone. This is the default for directories that are at the root of your hard drives, as opposed to directories that are underneath your user name. A directory such as d:\aspDemo is, by default, accessible by everyone. The directory c:\Documents and Settings\Yehuda Shiran\My Documents\aspDemo, on the other hand, will not be accessible by Everyone. In Windows 2000, to verify the security level of your directory, right click its icon and pick Sharing.... The Security tab should have it accessible by Everyone, shown on this window:

Also, it is not sufficient to change the setting of your directory alone. You need to make sure all its parent directories can be accessible by Everyone.

In both Windows XP and Windows 2000, make sure you can share this directory on the Web. Web sharing is turned on automatically when you define your Web server's Default Web Site. When you assign the Default Web Site's directory on your hard drive, the IIS Web server changes that directory's Web Sharing properties. Suppose your directory is d:\aspDemo as we showed above. When you right-click its icon and pick Sharing and Security... in Windows XP or Sharing... in Windows 2000, you'd get the following Web Sharing tab:

As you can see, the directory already "knows" its alias on the IIS Web server: Column113. This registration is done automatically when you create your IIS virtual directory (more on this on the next page). Of course, a directory may have several aliases, i.e. it can be referenced by several default Web sites.

Next: How to create a proxy

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Fixing MySQL Replication · Firewall Guide: First Steps to Securing the Enterprise · VoxOx Tames the Tumultuous Communications Tangle


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: June 30, 2002
Revised: June 30, 2002

URL: http://www.webreference.com/js/column113/3.html