473,657 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

subdomains on a domain. Can someone help me?

8 New Member
Hi friends..

Is it possible to find subdomains on a domain. Can someone help me?

currently i'm using this code..


Expand|Select|Wrap|Line Numbers
  1. private static String GetSubDomain(URL url)             
  2.     {
  3.               String host = url.getHost().toString();
  4.          Pattern p = Pattern.compile("[.]");
  5.         String u[]=p.split(url.getAuthority());
  6.         if (u.length > 2)
  7.           {
  8.             int lastIndex = host.lastIndexOf(".");
  9.            int index = host.lastIndexOf(".", lastIndex - 1);
  10.  
  11.            return host.substring(0, index);
  12.          }
  13.              return null;
  14.     }
but it is not working for some domains like http://www.mail.yahoo. co.in and http://www2.austin.cc. tx.us

Any help will be greatly appreciated.. thanks
Feb 18 '08 #1
1 3341
Plater
7,872 Recognized Expert Expert
What do you mean by "it doesn't work"? Does it "miss" sections of the url that should be listed.
What are you considering a domain and what a subdomain? When you get down to it, pretty much everything is a subdomain. thescripts is a subdomain of the .COM domain. And you can trace higher to the arpa domains and such too.
Feb 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1777
by: craigkenisston | last post by:
In an application I'm developing I will be using subdomains in the main website to hold some sections of the sites. There will be many serverside generated links that will point to this subdomains. I already have subdomains in a preproduction server and it works fine then, but how do I do that here in my development machine ?? I have WindowsXP SP2, but I don't see anyplace where I can create subdomains, since everything are actually...
2
2745
by: craigkenisston | last post by:
Hi, I create a one day ticket in my authentication code like this : private void btnLogin_Click(object sender, System.EventArgs e) { string _userId = txtUserId.Text; string _password = txtPassword.Text;
4
2034
by: radiax | last post by:
Is there a way to associate or bind a subdomain to a tcp sockets under .net framework (vb.net / c#). I know ip address can be used when using sockets, but the problem is the ip address is shared among subdomains (limited ips supply). Iam looking for possible way to use subdomain.domain.com instead of ip address. Any inputs?? thanks
1
5648
by: Hans Kesting | last post by:
Hi, Is it possible to share sessions between subdomains? Say: the user logs in at www.company.com, and is redirected to my.company.com. This is a different url for the same application. Can I keep the session (so I still know WHO has logged in)? The problem (as I see it) is the session-cookie. If that has a domain of "www.company.com", it will not be transferred to "my.company.com".
4
1525
by: Jim Carlock | last post by:
$_SERVER returns the root path for the subdomain, which is different than the root path for the primary domain. Is there a global variable to get the path for the root domain? What's the best way to handle this when you want to keep use the logo for the root domain? --
1
3317
by: Abandoned | last post by:
Hi.. I set cookie from www.domain.com but i'cant read this cookie from subdomain.domain.com How can i set cookie for all subdomains ? My set cookie code is: cookie = Cookie.Cookie('Login-Data', data) cookie.expires = time.time() + 9920000 Cookie.add_cookie(req, cookie)
9
7793
by: Josh | last post by:
I run a Joomla website and am familiar with php in some but not all aspects. Currently I am trying to find some solutions related to session handling. Am I correct in saying that "login" is kept in sessions? I can see active sessions in my mysql database, but is that the only place this information is stored? Sessions and cookies I know are related also, but how specifically (session info stored in cookies?)? Right now, when users...
3
1843
by: bnashenas1984 | last post by:
Hi everyone I'v made a website which allows users to have their own subdomains Each user can have a blog in a unique subdomain Now I need to let my users register their own domain names and point it to their subdomain on my website. For example : when a user registers a domain name on any website (www.usersname.com) and connects it to his subdomain (usersname.mywebsite.com) each time a visitor goes to that domain he should come to the...
3
2956
by: Jonathan Wood | last post by:
Perhaps someone who understand Web hosting can offer some insight into this. I have several sites hosted at http://www.crystaltech.com. There were highly recommended and seem pretty good. But this weekend I tried to create some subdomains. For example, subdomain1.domain.com and subdomain2.domain.com. While Crystal Tech supports this, subdomains must point to an IP address. Therefore, it is not possible to point the subdomain to a...
0
8420
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
8324
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
8740
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
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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.