farmerste Posted January 26, 2010 Posted January 26, 2010 hi all i am trying to find a way that i can pass a username only, to our mail server without the user entering it ( this is for special needs ) i can currently achieve this as follows by saving this url :- hachttp://mail.server/[email protected]&password=thepassword (the hach is used so you can see all in above example ) but i am wanting to know if there is a way to pass the username only, so that the username field is filled in, and the user doesn't have to type in the username each time, but has to enter a password each time. i currently put the url in the users 'home' folder so that only they can get to it, but i was trying to increase security, and have all but the most severe sen pupils enter a password. if i try the above without a password, or just left blank, then i just get the login page with all fields empty. any ideas? thanks
limbo Posted January 26, 2010 Posted January 26, 2010 Not sure which mail system you use, or what options are available to you but I would probably create an interim webpage to do the job. Your shortcut to the interim webpage could include just the information you want in the same way your current one does for the mail login. The interim page could then ask for the rest and redirect to the mail page. I think it could be done just with html code so would not need anything fancy to host it, and for your more severe sen kids they can keep the link they have now that goes straight to the mail server.
farmerste Posted January 26, 2010 Author Posted January 26, 2010 hi there, thanks for the advice, but my knowledge of creating web pages is basic, to say the least. But i can see where you are coming from
limbo Posted January 26, 2010 Posted January 26, 2010 (edited) This is using asp code - which should work on your mail server because it looks like that is what it uses. </pre><form action="http://mail.server/login.aspx" method="get" name="maillogin"> Please Enter Password for <%=request.querystring("username")%>:- "/> < As long as you pass to it the url including [email protected] then it will pass the information, including the entered password, on to the mail server exactly as your original example. Edited January 26, 2010 by limbo forgot the username field in the original post
farmerste Posted January 27, 2010 Author Posted January 27, 2010 thanks for that, but i cant get it to work, i cannot tell which of the fields"username" i should be replacing with the actual username i.e [email protected] etc i also saved it as a .htm, i am assuming that is ok could you explain what each line does? thanks
limbo Posted January 27, 2010 Posted January 27, 2010 This is asp code, so does need to be saved with the extension .asp on a machine running iis (but it looks like your mail server is) the code is basically a form to be completed:- </pre><form action="http://mail.server/login.aspx" method="get" name="maillogin">< Sets up the form including telling it where to pass the information to - in this case 'http://mail.server.login.aspx' so you replace that with the url of the login page of the webserver that your original shortcut was pointing to. Anywhere that uses the code <%=request.querystring("username")%> is basically saying replace this bit of code with the value in the url that follows 'username=' (this is the asp code) So it uses this to display the username and also puts it into a hidden form field:- Which it will pass on to the login form, but does not bother to display it. If you were to replcae the type="hidden" with type="text" then it will display this field for you to see with the login name in. is the password entry box - type="password" means that the characters are hidden when they are typed in. Again if you replaced it with type="text" then the characters would be visible as you typed them Finally is the button that sumbits the form. 1
farmerste Posted January 27, 2010 Author Posted January 27, 2010 hi, thanks for the explanation, however i cannot make/save an .asp file on my workstation.( unrecognised file anyway) The mail server we are using does not reside inside our building, it is on the district WAN, we currently access it by either typing its ip addy into the address bar, or by using an IE shortcut. I therefore need , if possible a way to do this that will work on a machine as a shortcut for internet explorer.
webman Posted January 27, 2010 Posted January 27, 2010 One way might be to re-produce the actual HTML form in a local webpage, with the username already filled in, prompt the user for their password and submit it to the same place that the official form goes to. This way, the server is getting everything it expects from the original form. Can you upload the code from the login.aspx page (go to it then View > Source) as a text file so I can have a look please to see if that would work? (ASP can sometimes be problematic with the way it handles forms).
farmerste Posted January 27, 2010 Author Posted January 27, 2010 here is the text:- Login function stopEnter() { var pwd = document.getElementById('txtPassword').value; if (pwd.length == 0) { return !(window.event && window.event.keyCode == 13); } else { return true; } } function ClearPwdChkbox() { var uname = document.getElementById('chkRememberUsername'); var pwd = document.getElementById('chkRememberPassword'); if (!uname.checked) { pwd.checked = false; pwd.disabled = true; } else { pwd.disabled = false; } } function CheckUnameChkbox() { var uname = document.getElementById('chkRememberUsername'); var pwd = document.getElementById('chkRememberPassword'); if ((pwd.checked) && (!uname.checked)) { uname.checked = true; } } function PopulatePassword(sValue) { document.getElementById('txtPassword').value = sValue; } function KeyDownHandler(btn) { // process only the Enter key if (event.keyCode == 13) { // cancel the default submit event.returnValue=false; event.cancel = true; // submit the form by programmatically clicking the specified button document.getElementById(btn).click(); } } function CheckForParent() { if (window != window.top) { window.top.location.href = "Login.aspx"; } } function SetFocus() { if (document.login.txtUsername) { document.login.txtUsername.focus(); } } function ClearPassword() { document.login.txtPassword.value = ''; document.login.hdnPwdChanged.value = 'yes'; } Username: Password: Language: English 简体中文 繁體中文 Français Deutsch Italiano 日本語 Español Use Web Messaging Lite Remember my username Remember my password apologies for long text file
limbo Posted January 28, 2010 Posted January 28, 2010 Any microsoft workstation with iis should easily be able to host the asp code without it using up any resources. Personally never had any experience of asp being problematic with handling forms.
webman Posted January 28, 2010 Posted January 28, 2010 OK, thanks for posting that farmerste. But I don't think my idea will work though, due to the nature of the way ASP.NET handles forms and all of its obscure hidden fields. @limbo: Running IIS on every workstation seems overkill just for getting the username to be auto-filled.
limbo Posted January 28, 2010 Posted January 28, 2010 Not suggesting running iis one every system - just one system will do it, as long as the shortcut includes the username, which is what was suggested. Everyone's shortcut can point to that one workstation / server, via ip address if necessary, and then it will process and pass on to the web server.
limbo Posted January 28, 2010 Posted January 28, 2010 Of course the other option is to build a unique html page for each person to live in their user area. The only reason for the asp is so you can pass the username as part of the url to this interim page. The following code:- </pre><form action="http://mail.server/login.aspx" method="get" name="maillogin"> </for Would ask for a password and pass it on to the server with "[email protected]" as the username and whatever is typed in the box as the password. Because there is no asp code then this could be saved as html and run from anywhere. 1
farmerste Posted February 1, 2010 Author Posted February 1, 2010 thanks for that, yep that works, i think the 'value=' in line 2, had the'=' missing, once i sorted that out it worked fine ( after entering account username of course) much appreciated
farmerste Posted March 29, 2012 Author Posted March 29, 2012 can anyone help me now we are moving to live @edu, or outlook-live, i am trying the following as a html file :- Please enter the password for username at outlook live it doesn't pass the password field to outlook live properly, does anyone know if this can be done, or how can i make the above just pass the username fields, and wait for the user to input their password. i intend to make a html file for each user that needs this feature ( with their username already in there), like i did with my previous mail server logon. many thanks
farmerste Posted September 13, 2012 Author Posted September 13, 2012 i have used the above to pass the username only with a bit of editing to outlook.com, but it no longer works, so i have changed the website to login.live as in :- Please press GO to auto fill a.user Outlook Live logon if you copy and paste into notepad, and save as a html page, you can see it will pass the username correctly, but as soon as you have entered the password it falls down? can anyone help with this? thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now