Need to get domain name

I need to get the user domain as well as the user name. 
Getting the name is easy but can't find anything that gets
me the domain.  .Net has Environment.UserDomainName()  Does
PB have anything similar or does anyone know the API call
that will get me what I need?

thanks
0
Darren
3/28/2005 4:52:06 PM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

3 Replies
1053 Views

Similar Articles

[PageSpeed] 56

Try this:

http://msdn.microsoft.com/library/en-us/netmgmt/netmgmt/netwkstausergetinfo.asp?frame=true


<Darren> wrote in message news:42483636.25b8.1681692777@sybase.com...
> I need to get the user domain as well as the user name.
> Getting the name is easy but can't find anything that gets
> me the domain.  .Net has Environment.UserDomainName()  Does
> PB have anything similar or does anyone know the API call
> that will get me what I need?
>
> thanks


0
Tim
3/29/2005 1:08:34 PM
Try the following:


OLEObject  l_ole
int    li_rc
string   ls_domain, ls_user, ls_site, ls_computername

l_ole = CREATE OLEObject
li_rc = l_ole.ConnectToNewObject( "ADSystemInfo")

IF li_rc = 0 THEN
   ls_computername = l_ole.computername //
CN=CAL26040,OU=Computers,OU=calgary,DC=forestoil,DC=com
   ls_site = l_ole.sitename     // calgary
   ls_user = l_ole.username     // CN=Terry Dykstra
(tddykstra),OU=Users,OU=calgary,DC=forestoil,DC=com
   ls_domain = l_ole.domaindnsname    // forestoil.com
END IF

l_ole.DisConnectObject()
DESTROY l_ole


-- 
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://www.pb9books.com
product enhancement requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement


"Tim Mitchell" <TMITCHELL@idoc.~spamaway~state.il.us> wrote in message
news:42495352@forums-1-dub...
> Try this:
>
>
http://msdn.microsoft.com/library/en-us/netmgmt/netmgmt/netwkstausergetinfo.asp?frame=true
>
>
> <Darren> wrote in message news:42483636.25b8.1681692777@sybase.com...
> > I need to get the user domain as well as the user name.
> > Getting the name is easy but can't find anything that gets
> > me the domain.  .Net has Environment.UserDomainName()  Does
> > PB have anything similar or does anyone know the API call
> > that will get me what I need?
> >
> > thanks
>
>


0
Terry
3/29/2005 6:56:03 PM
This ole script works.  Thanks Terry


> Try the following:
>
>
> OLEObject  l_ole
> int    li_rc
> string   ls_domain, ls_user, ls_site, ls_computername
>
> l_ole = CREATE OLEObject
> li_rc = l_ole.ConnectToNewObject( "ADSystemInfo")
>
> IF li_rc = 0 THEN
>    ls_computername = l_ole.computername //
> CN=CAL26040,OU=Computers,OU=calgary,DC=forestoil,DC=com
>    ls_site = l_ole.sitename     // calgary
>    ls_user = l_ole.username     // CN=Terry Dykstra
> (tddykstra),OU=Users,OU=calgary,DC=forestoil,DC=com
>    ls_domain = l_ole.domaindnsname    // forestoil.com
> END IF
>
> l_ole.DisConnectObject()
> DESTROY l_ole
>
>
> --
> Terry Dykstra (TeamSybase)
> http://powerbuilder.codeXchange.sybase.com/
> http://www.pb9books.com
> product enhancement requests:
> http://my.isug.com/cgi-bin/1/c/submit_enhancement
0
Darren
4/4/2005 6:25:35 PM
Reply:

Similar Artilces:

Need Regular Expression to get domain name and extension
Is there one Regular Expression that will find a domain and extension in a typical URL Example: http://www.Website.com/admin/find.aspx resolves to   Website.comExample: www.Website.com?subset="temp" resolves to   Website.comExample: Website.com/admin resolves to   Website.com The problem is that the 2nd two samples are not valid URLs.  They are missing the scheme section http://en.wikipedia.org/wiki/URL However, maybe you can get the UriBuilder to help parse the text as a first step:         ...

ContextType.Domain gets PrincipalServerDownException unless specify domain controller by name
Hi There Just trying out the new System.DirectoryServices.AccountManagement with Visual Studio 2008 Express Edition.  My scenario:  -Client Windows XP joined to domain -One Windows Server 2003 domain controller / IIS  I want to get the full name of the logged in user. This works if I specify the domain controller name. Specifying the domain name (either fully qualified or NETBIOS) does not work. Any suggestions ? Am I doing something wrong here.   My working code is like this:   Dim domainContext As New System.DirectoryServices.AccountManagement.PrincipalCo...

Getting the domain name
Hello, We have a fairly simple redirect script a url is entered, and even tho there are directions to not enter the "http://www" sometimes we get it or "http://"... what is the simplest method to extract just the domain name if a "http://www.somedomain_name.com" or "http://somedomain_name.com" is enter so we can extract just the "somedomain_name.com" thx's -- Mike<mickalo>Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-...

Getting a domain name.
Where would you buy a .com domain name from? On Thu, 15 Sep 2011 14:18:54 +0000, Arthur wrote: > Where would you buy a .com domain name from? There are a whole lot of choices most of which are good. We have settled on Domain Monger. I use www.networksolutions.com, that way you actually own the domain, you have to be careful with some third party domain registration companies as they register the domain on your behalf. but set themselves up as the owner. So if you want to move things or mange the domain you have to deal with them. and trying to get the ownership becomes a h...

Getting the domain name
Hello, We have a fairly simple redirect script a url is entered, and even tho there are directions to not enter the "http://www" sometimes we get it or "http://"... what is the simplest method to extract just the domain name if a "http://www.somedomain_name.com" or "http://somedomain_name.com" is enter so we can extract just the "somedomain_name.com" thx's -- Mike<mickalo>Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-ra...

Get domain name
I am tryng to find the simplest way to get the domain name of the site that some code is running under, on the web I find this: Environment.UserDomainName.ToString Which always returns my server hostname... not what I want..Ask One/Answer One.  maybe something like dis? string url = Request.Url.AbsolutePath; orRequest.Url.DnsSafeHost +Lvl FIVE THOUSAND DRAGON MASTER SOFTWARE ENGINEER my friends call me MOI You can get the hostname from a HttpRequest, e.g.  Page.Request.Url.Host if you are executing in a aspx page.The problem is that since the site may be running with se...

Getting Domain Name
How do you capture the domain name from within PB? I assume win api is needed, does anyone know the call? Mike, Since no one has answered you, you might check out FUNCky for PB... the FUNCky.Domain() method returnes the logged in Domain name. Its a little annoying to do through the Win Api so you might save some headaches using an add-on. -Dirk [FUNCky Developer] [dLESKO Inc.] <-- Got FUNCky? Get it now at http://www.funcky.com. FUNCky Rocks! --> Here's another easy way -- using the Microsoft Scripting Host (installed with Win98 and W2K, and also avai...

How to get domain user's first name, last name and e-mail address
Hi everyone, I am able to retrieve the domain/user ID by setting <authentication mode="Windows"/> in the Web.config file, and with the following code in my Default.aspx.,cs page: string strName = Request.ServerVariables["AUTH_USER"]; I would also like to retrieve the users first name, last name and e-mail address from their domain profile, if possible.  Can anyone help me with a code example?  I'm somewhat new to C#/.NET/OOP so if you have it in "C# for Dummies" format, I would be very thankful! Thanks in advance for any help that i...

Domain name forwarding
HiI have written a portal content management system, so that different users have different sites such as:www.portalsite.com/default.aspx?SiteID=1www.portalsite.com/default.aspx?SiteID=2       etc. I have managed to URL rewrite, in the global.asax, to give friendly URLs such as:www.portalsite.com/user01www.portalsite.com/user02 However some users have their own registered domain names which they can forward to their portal site.  For example a user may have 'www.mydomainname.com' (hosted with another ISP) which they forward to point to their portal address ...

getting only domain names from list
Hello all, I have a list from a logfile that has urls browsed. I have to extract all domainnames considering subdomains as the same as the domainnames eg @list = qw( yahoo.com mail.yahoo.com hotmail.com yahoo.co.in cnn.co.uk news.cnn.co.uk) I would like to write a function that will give me only the unique domainnames @uniq = qw(yahoo.com hotmail.com yahoo.co.in cnn.co.uk) I have a feeling someone would have done this before Thanx Ramprasad A Padmanabhan ...

Getting the right most of the domain name
Hello,I want to get the right most name of the a domain name, for example:if the domain is www.myweb.com , I want to get myweb.comsomething.myweb.com -->  myweb.comwww.myweb.com.au -->  myweb.com.ausomething.myweb.com.au -->  myweb.com.auwww.myweb.tv --> myweb.tvwww.something.myweb.net --> myweb.netmy.test.myweb.ca --> myweb.caI want to know if there is a general rule, code or article regarding this issue. I tried the following code, but I am not convinced, because it is not genericpublic static string GetDomainName(string serverName ) {if(!serverName.Contain...

Need Multiple Domain Names...
All, This is likely some simple thing, but not if you don't know. I am looking for how to go about setting up multiple Domain names on my new GroupWise 6.5 running on NW 6.5. I have the GWIA installed and working, but need to add additional domains. I also need for some users to use one domain as their 'from' address, and others to user another, and yet others to have access to all of them. How do I do this???... Thanx, Eric Fors, II 417.879.3154 eric2@dameron-color-labs.com eric2@dameron-color-labs.com wrote: > This is likely some simple th...

How to get full domain name ?
I have some function to fetch domain name : /////////// --- start const NERR_Success = 0; function NetWkstaGetInfo(ServerName: LPWSTR; Level: DWORD; BufPtr: Pointer): Longint; stdcall; external 'netapi32.dll' Name 'NetWkstaGetInfo'; function GetNetParam(AParam: Integer): string; var PBuf: LPWKSTA_INFO_100; Res: LongInt; begin Result := ''; Res := NetWkstaGetInfo(nil, 100, @PBuf); if Res = NERR_Success then begin case AParam of 0: Result := string(PBuf^.wki100_computername); 1: Result := string(PBuf^.wki100_lan...

get parked domain name
--part1_12e.ed205a2.29d39e2c_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit I just parked a domain name a few days ago and now I want to use it. But I can't seem to access it with the $ENV variables. I've tried $ENV{'SERVER_NAME'} Which I thought would do the trick! Anyone have any tricks up their sleeve? Thanks Tricia --part1_12e.ed205a2.29d39e2c_boundary-- ...

Web resources about - Need to get domain name - sybase.powerbuilder.general

Domain name - Wikipedia, the free encyclopedia
A domain name is an identification string that defines a realm of administrative autonomy, authority, or control on the Internet . Domain names ...

Apple registers three car-related domain names, hinting at its electric vehicle project
... during media events while Tim Cook has resisted denying the project . The biggest tease to date comes in the form of new car-related domain ...

Apple registers a series of car-related domains
Apple registered three car-related domains in December, according to a recent report, potentially signaling the developing of the much-rumored ...

New domain registration sparks iCar chatter
You may not be able to buy an Apple Car yet, but an Apple Car website could be in the works.

Apple snaps up a trio of car-related web domains
... evidence is lending further weight to the possibility that we may one day cruise down the street in an Apple Car. Listings on domain search ...

NY Public Library releases 180,000 free public domain pictures
The New York Public Library has made 180,000 old-timey, out-of-copyright pictures available as high-res downloads through its Digital Collections ...

The Public Domain Once Again Loses In The New Year
... of every year under US Copyright Law, creative and scientific works that have reached the end of their copyright terms go into the public domain. ...

Anne Frank's Diary and Adolf Hitler's Mein Kampf Both Enter the Public Domain on Friday
A copyright fight is brewing in Europe this week as the deadline after which two key WWII-era texts will fall within the public domain steadily ...

Microsoft expands Get Windows 10 campaign to domain-joined Win7, Win8.1 PCs
Windows 7 Pro and 8.1 Pro users joined to an Active Directory domain are about to be pummeled by nagware, and the arcane blocking process is ...

Apple Just Called Dibs On A Few Car-Related Domain Names
... it happen eventually, and it we may just be getting closer to that day—in December, the company registered several car-related website domain ...

Resources last updated: 1/17/2016 2:49:53 PM