Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a Web Page and pass login details 1

Status
Not open for further replies.

jon24422531

Technical User
Jan 27, 2004
295
0
0
GB
Hi guys

Not sure if this is possible in ASP, but here goes....

Our customers are able to access data on their transactions with us over a secure internet application. We grant them access through a user name and password that is stored in a SQL table. We used to add these users in an Outlook VBA application that I have since transferred to our Intranet. So far so good, but the Outlook VBA also had a button through which you could open the Internet page and the logon details were filled in. This was an excellent way of checking it worked and also troubleshooting any users problems.

This is the VBA code:
Code:
Private Sub FTWO_Open_Click()

    Dim AltKey As String
    Dim CtrlKey As String
    Dim ShiftKey As String
    Dim TabKey As String
    Dim EnterKey As String
    Dim obj As InternetExplorer

    AltKey = "%"
    CtrlKey = "^"
    ShiftKey = "+"
    TabKey = "{TAB}"
    EnterKey = "~"
    
    Set obj = CreateObject("InternetExplorer.Application")
    obj.Toolbar = 1        'show toolbar
    obj.Visible = True     'show Internet Explorer
    
    Call obj.Navigate(ThisOutlookSession.FTWebURL)
    
    ThisOutlookSession.SleepLength = 5000
    Call Sleep_Time
    
    SendKeys LoginTextBox.Text, False
    SendKeys TabKey, False
    SendKeys PasswordPrefixTextBox.Text, False
    SendKeys TabKey, False
    SendKeys ThisOutlookSession.FTWebCustomerToLookup, False
    SendKeys TabKey, False
    SendKeys EnterKey, False

End Sub
Is there any way of doing something similar in ASP?

Jonathan
 
so you want to simulate a client login?

That sounds basically like calling the login.asp with the userid and password fields already filled in....

?


 
Hi Foxbox

That's exactly what I want. One of our team can either create or modify a user and then at the press of a button open a new web page with their details entered.

Can we do it?

Jonathan
 
a user name and password that is stored in a SQL table."
"I have since transferred to our Intranet."

so the user maintenance program is running on your intranet?

so roughly we do this: (pseudocode)

In login.asp:
Code:
cUserID = request.querystring("uid")
cPassword = request.querystring("pwd") ' Encrypted!!!

if cPassword <> "" then
 cPassword = Decypher(cPassword)   'UDF!!
end if


[code]

<input type=text name=fuserid value="<%= cUserid %>">
<input type=hidden name=fuserid value="<%= cPassword %>">



In your maintenance page you have a link/button that calls:

login.asp?uid=<% cUserId %>&pwd=<%= cEncryptedPassword %>



PS
Excellent encryption solution:
 
Typo!:
Code:
<input type=hidden name=fPassword value="<%= cPassword %>">
 
Ah, Foxbox an elegant solution but.. (there's always a but)

Login.asp is part of our customers Internet application that was written by a 3rd party over which we have little control.

In the VBA version we were simply opening the website and then passing keystrokes (with suitable pauses) and I think this is what we need to reproduce. So really is there an ASP equivalent to SendKeys?

Jonathan
 
Test.hta ( !HTA extention!)
Code:
<HTML>  
<HEAD>  
<TITLE>Default HTA</TITLE>  
<HTA:APPLICATION>  
</HEAD>  
  
<SCRIPT Language="Javascript">
    function PutInSampleText() 
{
  document.frames("myIFrame").document.frmLogin.fUid.value = "Foxbox";
}
</SCRIPT>  
  
<BODY onLoad="PutInSampleText();">  
  <IFRAME id="myIFrame" SRC="login.asp" APPLICATION="yes">
  </IFRAME>
</BODY>  
</HTML>

Login.asp:
Code:
<form name=frmLogin>
UserId:<input type="test" name=fUid>
</form>


(you must search the form name and field names in your login.asp)


Works only on IE, and again proves the power of HTA


 
Foxbox

I can't seem to make it work, but I have to log off now. I'll have another look in the morning...

Thanks for your help and I'll let you know as soon as I've had another try.

Jonathan
 
Worked here. 2 seperate files on an IIS box (so both in the same domain -i think thats mandatory-), and using IE to open the .HTA (maybe there is another association on your client).

Due to security issues firefox prevents starting HTA files..
 
Now I see the problem Foxbox. The web address I'm trying to get to is in a DMZ on the other side of our network (as it is for external customer access to information on our SQL server)

That is why it won't work , but is also why the VBA sendKeys can.

Not sure what to try next....

Jonathan
 
Copy the login.asp page (and all include files, etc) from DMZ to inside?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top