Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 August 10th, 2004, 01:05 PM
Authorized User
 
Join Date: Sep 2003
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to flyin
Default How do i retrieve the Domain name from a url

Hello all.

I want to some how with the Referring URL to my site, extract the domain name as easily as possible. Is there a way to do this without writing a whacky reg ex or am i stuck with trying to figure out how to do this?

Does there exist an object that i can use to do the following:

Dim sURL = request.URLReferrer

Dim someObj as SomeObject

someObject.GetInfoOnThisURL(sURL)

resonse.write("<BR> Domain Name = " & someObj.DomainName)

sorry for the "someObject" naming convention, but i'm just trying to figure out what object(s) i can use in order to gain information from a requested URL because i just want the easiest possible way to get a result of MyDomain.com from

http://www.mydomain.com/cgi-bin/u/s/a/index.php

thanks for all your help in advance.

 
Old August 11th, 2004, 12:54 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Create an instance of the Uri class with the url and access the hostname with the Uri's class Host property.
(eg)
Dim baseUri As New Uri("http://www.mydomain.com/cgi-bin/u/s/a/index.php")
Response.write(baseUri.Host)


 
Old August 11th, 2004, 07:54 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to populate Send a message via Yahoo to populate
Default

User SERVER Variables to get on these (i.e. server Name, URI etc..). Next used As New Uri(...).

Cheers!


Thanks!
Populate
 
Old August 11th, 2004, 12:27 PM
Authorized User
 
Join Date: Sep 2003
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to flyin
Default

thank you santhi and populate, it works just fine!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Prob with retrieve the url of a child window from. vishnu108mishra ASP.NET 2.0 Professional 3 December 5th, 2007 09:14 AM
Same pages for sub domain from main domain vivek_inos ASP.NET 1.0 and 1.1 Professional 1 February 13th, 2007 10:15 AM
extract URL from Favorites (.URL Files) PhilHawks VB.NET 2002/2003 Basics 2 November 2nd, 2004 04:35 AM
Retrieve and store the images from server URL ccc_storage Classic ASP Professional 13 August 19th, 2004 07:28 AM
http://domain or http://www.domain anshul HTML Code Clinic 9 August 11th, 2004 01:09 AM





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