• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

FrontPage Form on a Domain - HELP

I am running a simple webpage created in FP to request information from a user.  This webpage is internal to my domain only.  I would like to automatically see who they are logged in as (login name) and add that to a field in the form.  This webserver is on a 2000 server running Active directory.  User's don't have to log into this page as they are already authenticated.  Is there any way to capture this info?'

DG
0
dgrow
Asked:
dgrow
  • 7
  • 7
1 Solution
 
rcmbCommented:
First you must turn anonymous access off! This is done in the IIS control panel.

Then the page must be an ASP page and you need to insert this code:

<%
Function getLoginUser()
    Dim strCurUserID, arrCurUserID
    strCurUserID = REPLACE(request.ServerVariable("LOGON_USER", "\","/")
    arrCurUserID = Split(strCurUserID,"/")
    getLoginUser = arrCurUserID(ubound(arrCurUserID))
End function
%>

Put this inside your form tags

<input type=hidden name=username value=<%=getLoginUser%>>

Now when you write to the database or whaterver

INSERT INTO Table (UserName) Values ('::username::')

RCMB
0
 
dgrowAuthor Commented:
RCMB:

Thanks for the info.  We are going to be using an e-mail response from the form to an exchange mailbox.  I am assuming I can set the value for a field and have it result out of the form to the e-mail.  Correct?

DG
0
 
dgrowAuthor Commented:
Having problems getting this functon to work.  Won't display page.

DG
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
rcmbCommented:
No you are not quite correct. Sending the email is a little different as FrontPage send email will not work with an ASP page. You will need to use something like CDONTS to send the email. Since this is internal and you control the environment I will post you a solution here. Give me a little bit to gather the code.

RCMB
0
 
rcmbCommented:
Okay here is what you need to do

Create a new page and save it as sendmsg.asp

Put this code in your sendmsg.asp file before the <head> tag

Edit the information required

<%
' Send by connecting to port 25 of the SMTP server.

'Email address of the person receiving the email
strEmail = "" & request("emailaddress") & ""
strSubject = "PUT YOUR EMAIL SUBJECT HERE"

Const cdoSendUsingPort = 2

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
'Replace 0.0.0.0 with the IP address of your email server
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "0.0.0.0"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10  
    .Update
End With

' Apply the settings to the message.
With iMsg
    Set .Configuration = iConf
    .To = strEmail
    .From = "Webmaster@yourdomain.com"
    .Subject = strSubject
    .HTMLBody = "Put your email body here"
    .Send
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>

Save your file

Open the file that contains your form, right click inside the form and select form properties and options. Change the destination of the form to sendmsg.asp

Now save that page and test it.

You can add a response.redirect to the end of your sendmsg.asp page to have the page redirect to another file after it sends the message or you can make it display a note like -- Thanks for your submission. You will be receiving an email with the information you have submitted. Please click here to return to the home page.

Let me know if you need more help.

RCMB
0
 
dgrowAuthor Commented:
Thanks!  The e-mail portion worked great.  I can see I need to brush up on my html.  The last problem I have is that I need to information from the form to be sent in the e-mail.  I must be missing something.

DG
0
 
rcmbCommented:
  .HTMLBody = "Put your email body here"

You can replace the info between the "" with your information.

The base way to capture all of this is to use request.form("FieldName") and assign them to variables.

Somelike:

varMsg = request.form("MessageBody")

.HTMLBody = varMsg

This way you can use anything being sent by the form and put it whereever you need it.

RCMB
0
 
dgrowAuthor Commented:
Thanks.  I had done the above already.  

I would like to send a formatted message that has all the form information in the message and is nice looking.  I assume there is a way to create an html text file with the proper formatting and variable names from the form and have that sent as the body.  In using the straight .htmlbody = command, how would I get all 18 fields values with labels (e.g. Potential Client Name: <%=request.form("Potential_Client_Name")%>) into a nice looking e-mail with blank lines, horizontal line separators, etc into the message.  I assume a file that is preformatted with the nice looking html code and the appropriate variable names is possible.

Thanks again for your patience and help.  You've opened my eyes quite a bit and made me realize it's time to get a book.

DG
0
 
rcmbCommented:
Okay it will take a bit of coding but here is how you do it:

' build HTML for message body
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "Potential Client Name: " & request.form("Potential_Client_Name") & "<br>"
strHTML = strHTML & "<hr>" 'creates line separator
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

.HTMLBody = strHTML

RCMB
0
 
rcmbCommented:
Glad to help.

RCMB
0
 
dgrowAuthor Commented:
Thanks.  I figured it out.  I did it a similiar way.  I created the HTML file to look exactly like I wanted it and put unique placemarkers on the page (@@@client@@@).  I save the html file as a text file.  Part of the routine is to assign all the request.form(variable) to variables.  I have a routine that uses readall to read the file and assign to BodyText.  I used the replace command to replace the variable for the place marker for each field.  Kind of kludgy, but works!

Thanks again for your help.

DG
0
 
dgrowAuthor Commented:
RCMB -

I'm 99.9% there.  The only issue I have now is that the boxes that are textboxes.  I'll enter text on several lines (done by hitting return in the textbox).  

For example, in the comments textbox:

<textarea rows="2" name="Comments" cols="55" style="font-family: Arial; font-size: 12pt" wrap="hard"></textarea>

I enter the following information:

Line 1
Line 2
Line 3

When I use the Comments=request.form("Comments") command in the sendmsg.asp, the return I get is:

Line 1 Line 2 Line 3.   It doesn't retain the hardreturns

As you can see, I've used the wrap="hard" (as well as wrap=hard".  I've also tried the <PRE></PRE> command that I found in another post.  I also found one post that said to use the replace command Comments= Replace(Comments, "<BR>", vbCrLf) as suggested.  It all keeps coming across as one line.

Thanks in advance for all your help

DG
0
 
rcmbCommented:
Use this code to edit your variable

varInfo = request.form("Info")
If ISNULL(varInfo) Then
  varInfo =  varInfo
Else
  varInfo = replace(varInfo,vbcrlf,"<BR>")
End if

RCMB
0
 
dgrowAuthor Commented:
You truly ARE an expert!

Thanks again!

DG
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now