retrieving web server name from a console app

hersheysc

Member
Joined
Jul 19, 2005
Messages
7
Programming Experience
5-10
I'll try to explain what is going on without confusing anyone.

We currently have a console app running on one our web servers that generates emails. It also generates an html file to be viewed by users. we
need to be able to pick up the name of the webserver the file lives on and build a web link to the html file, which will be sent to users in an email.

Any idea how this can be done? I'm wondering if you can pull http request variables from a console app.

Any help is appreciated greatly! :)
 
Er.. you simply need to put the file in the file system of the webserver concerned, and then do some string substitution to ensure that the URL ends up in the email correctly

Regardless of whether your web server is using host headers etc the file structure should be of a logical form.. I cannot see why you'd need the request variables because by the time they are being made, the file already exists.


App generates HelloWorld.htm and saves in c:\wwwroot\mysite\files\HelloWorld.htm
App sends an email containing a link to http://wonderweb.com/files/HelloWorld.htm

Are you telling me youre having severe difficulty working out how to make a path of c:\wwwroot\mysite\files\HelloWorld.htm into http://wonderweb.com/files/HelloWorld.htm given that the app has just written the file?
 
yes, that is what I'm saying. :) The current code is pulling the computer name of the server, but it doesn't match the address in the url.

*************
ServerName = Environ("COMPUTERNAME")
If ServerName Is Nothing Then
ErrorText = "This server does not have a COMPUTERNAME environment variable defined."
LeaveEmailSupv.UtilLib.LogError(Err, Nothing, ErrorText)
End
Else
strServerNameadm = "http://" & ServerName.ToString.ToLower & ".snoopy.net/"
End If
**************
The computer's name in this instance is qa1. The code above generates the link "http://qa1.snoopy.net" when it really needs to be
"http://qa1.campus.it.snoopy.net". (it lives on the 'snoopy' network on the 'it' domain on a windows server). In other words I need the actual host name, not the machine name.
 
Indeed, the NETBIOS name may have nothing to do with the DNS name that a computer has, but for internal use http://qa1/path/to/file.htm should work if the netbios name travels around the network. If it doesnt, and you want to use the DNS name, perform a reverse dns lookup from the IP address of the machine
 
Back
Top