+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
How do you do....it? Thread, pass user info to website in Technical; hi all i am trying to find a way that i can pass a username only, to our mail server ...
  1. #1
    farmerste's Avatar
    Join Date
    Mar 2007
    Location
    uk
    Posts
    339
    Thank Post
    100
    Thanked 23 Times in 20 Posts
    Rep Power
    21

    pass user info to website

    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/login.aspx?username=firstname@schoolname.sch.uk&pa ssword=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

  2. #2
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    25
    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.

  3. #3
    farmerste's Avatar
    Join Date
    Mar 2007
    Location
    uk
    Posts
    339
    Thank Post
    100
    Thanked 23 Times in 20 Posts
    Rep Power
    21

    thanks

    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

  4. #4
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    25
    This is using asp code - which should work on your mail server because it looks like that is what it uses.

    Code:
    <form action="http://mail.server/login.aspx" method="get" name="maillogin">
    Please Enter Password for <%=request.querystring("username")%>:-<br />
    <input name="username" type="hidden" value="<%=request.querystring("username")%>"/>
    <input name="password" type="password" /><input name="Login" type="submit" value="Login" />
    </form>
    As long as you pass to it the url including ?username=whatever@wherever.com then it will pass the information, including the entered password, on to the mail server exactly as your original example.
    Last edited by limbo; 26th January 2010 at 03:01 PM. Reason: forgot the username field in the original post

  5. #5
    farmerste's Avatar
    Join Date
    Mar 2007
    Location
    uk
    Posts
    339
    Thank Post
    100
    Thanked 23 Times in 20 Posts
    Rep Power
    21

    thanks but

    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 user@school.london.sch.uk etc
    i also saved it as a .htm, i am assuming that is ok
    could you explain what each line does?
    thanks

  6. #6
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    25
    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:-

    Code:
    <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

    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:-

    Code:
    <input name="username" type="hidden" value="<%=request.querystring("username")%>
    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.

    Code:
    <input name="password" type="password" />
    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

    Code:
    <input name="Login" type="submit" value="Login" />
    is the button that sumbits the form.

  7. Thanks to limbo from:

    farmerste (28th January 2010)

  8. #7
    farmerste's Avatar
    Join Date
    Mar 2007
    Location
    uk
    Posts
    339
    Thank Post
    100
    Thanked 23 Times in 20 Posts
    Rep Power
    21

    thanks again

    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.

  9. #8

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,400
    Thank Post
    636
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319
    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).

  10. #9
    farmerste's Avatar
    Join Date
    Mar 2007
    Location
    uk
    Posts
    339
    Thank Post
    100
    Thanked 23 Times in 20 Posts
    Rep Power
    21
    here is the text:-


    <!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.0 transitional//EN" >
    <html>
    <head>
    <title>Login</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="C#" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    <script type="text/javascript">
    <!-- hide from non JavaScript Browsers
    //This will pre-cache the login screen image and allow it to load faster.
    //If you have made your own custom image and altered the stylesheet, you will want
    //to remove this or alter the image name to reflect your new image name.
    Image1= new Image()
    Image1.src = "images/LoginBg.jpg"
    // End Hiding -->
    </script>
    <script language="javascript" type="text/javascript">
    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';
    }
    </script>
    <link href="Cypress.css" type="text/css" rel="stylesheet" />
    <link rel="icon" href="favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    </head>
    <body onload="CheckForParent(); SetFocus()">
    <form name="login" method="post" action="Login.aspx?ReturnUrl=%2fDefault.aspx" id="login">
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMjAzNDEwMDg0OQ9kFgICAQ9kFgICAw9kFgoCCw8QZBA VCAdFbmdsaXNoDOeugOS9k+S4reaWhwznuYHpq5TkuK3mlocJR nJhbsOnYWlzB0RldXRzY2gISXRhbGlhbm8J5pel5pys6KqeCEV zcGHDsW9sFQgFZW4tVVMFemgtQ04FemgtVFcFZnItRlIFZGUtR EUFaXQtSVQFamEtSlAFZXMtRVMUKwMIZ2dnZ2dnZ2cWAWZkAg0 PEA8WAh4EVGV4dAUWVXNlIFdlYiBNZXNzYWdpbmcgTGl0ZWRkZ GQCDw8QDxYCHwAFFFJlbWVtYmVyIG15IHVzZXJuYW1lFgIeB29 uY2xpY2sFEENsZWFyUHdkQ2hrYm94KClkZGQCEQ8QDxYCHwAFF FJlbWVtYmVyIG15IHBhc3N3b3JkFgIfAQUSQ2hlY2tVbmFtZUN oa2JveCgpZGRkAhUPDxYGHwAFBUxvZ2luHgVXaWR0aBsAAAAAA ABUQAEAAAAeBF8hU0ICgAJkZBgBBR5fX0NvbnRyb2xzUmVxdWl yZVBvc3RCYWNrS2V5X18WAwUSY2hrVXNlTGl0ZVRlbXBsYXRlB RNjaGtSZW1lbWJlclVzZXJuYW1lBRNjaGtSZW1lbWJlclBhc3N 3b3JkoRJCkihHsFqzzGyDE2/UJvuezr4=" />

    <script type="text/javascript">
    <!--
    var theForm = document.forms['login'];
    if (!theForm) {
    theForm = document.login;
    }
    function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
    theForm.__EVENTTARGET.value = eventTarget;
    theForm.__EVENTARGUMENT.value = eventArgument;
    theForm.submit();
    }
    }
    // -->
    </script>


    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWEQLbi7iuAQKl1bK4CQK1qbSRCwL5+vkbAuSM9tUIAtaH9sM OAu+HwrQBAo6PktcEAreNvvQFAruAnvAFAtyD5pgNAuSMgr0NA qztmKoFAqGsntADAsmg8toEAoLch4YMAoLj2osB4ozuK9GrdZj NqlisbSnStfXUepE=" />
    <table cellpadding="0" cellspacing="0" border="0" align="center" width="75%">
    <tr>
    <td valign="bottom" style="height:80;"><br />&nbsp;</td>
    </tr>
    </table>
    <div id="pnlLogin">

    <table align="center" cellspacing="0" cellpadding="0" border="0" class="LoginTable">
    <tr>
    <td rowspan="13" style="WIDTH: 30px">&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td style="HEIGHT: 125px" colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td align="right" style="WIDTH: 114px;"><span id="lblUsername" tabindex="-1" class="contentLabelCell">Username:</span>&nbsp;</td>
    <td><input name="txtUsername" type="text" maxlength="255" id="txtUsername" tabindex="3" class="inputTextMedToLarge" onkeypress="return stopEnter()" /></td>
    </tr>
    <tr>
    <td align="right" style="WIDTH: 114px; HEIGHT: 21px"><span id="lblPassword" tabindex="-1" class="contentLabelCell">Password:</span>&nbsp;</td>
    <td style="HEIGHT: 21px"><input name="txtPassword" type="password" id="txtPassword" onkeypress="return stopEnter()" onfocus="ClearPassword()" tabIndex="4" maxlength="31" class="inputTextMedToLarge" /></td>
    </tr>
    <tr>
    <td align="right" style="WIDTH: 114px; HEIGHT: 21px"><span id="lblLanguage" tabindex="-1" class="contentLabelCell">Language:</span>&nbsp;</td>
    <td style="HEIGHT: 21px"><select name="ddlLanguage" onchange="javascript:setTimeout('__doPostBack(\'dd lLanguage\',\'\')', 0)" language="javascript" id="ddlLanguage" class="inputTextMedToLarge" style="background-color:White;width:192px;">
    <option selected="selected" value="en-US">English</option>
    <option value="zh-CN">简体中文</option>
    <option value="zh-TW">繁體中文</option>
    <option value="fr-FR">Fran&#231;ais</option>
    <option value="de-DE">Deutsch</option>
    <option value="it-IT">Italiano</option>
    <option value="ja-JP">日本語</option>
    <option value="es-ES">Espa&#241;ol</option>

    </select></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><span class="contentLabelCell"><input id="chkUseLiteTemplate" type="checkbox" name="chkUseLiteTemplate" tabindex="5" /><label for="chkUseLiteTemplate">Use Web Messaging Lite</label></span></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><span class="contentLabelCell"><input id="chkRememberUsername" type="checkbox" name="chkRememberUsername" onclick="ClearPwdChkbox();" tabindex="6" /><label for="chkRememberUsername">Remember my username</label></span></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><span class="contentLabelCell"><input id="chkRememberPassword" type="checkbox" name="chkRememberPassword" onclick="CheckUnameChkbox();" tabindex="7" /><label for="chkRememberPassword">Remember my password</label></span><BR>
    <span id="lblStatus" tabindex="-1" class="LoginError" style="color:Red;"></span><BR>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" name="btnLogin" value="Login" id="btnLogin" class="loginButton" style="width:80px;" />
    </td>
    </tr>
    <tr>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="3" style="HEIGHT: 50px">&nbsp;</td>
    </tr>
    </table>
    <span id="lblVersion" tabindex="-1"><!-- App_Web_6wvj72tt Version: 0.0.0.0 Created at: 11/17/2009 11:24:11 PM /--></span>
    <input name="hdnPwdChanged" type="hidden" id="hdnPwdChanged" />

    </div>

    <script language=javascript>ClearPwdChkbox();</script></form>
    </body>
    </html>

    apologies for long text file

  11. #10
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    25
    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.

  12. #11

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,400
    Thank Post
    636
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319
    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.

  13. #12
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    25
    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.

  14. #13

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,400
    Thank Post
    636
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319
    @limbo: Yeah, that makes sense.

  15. #14
    farmerste's Avatar
    Join Date
    Mar 2007
    Location
    uk
    Posts
    339
    Thank Post
    100
    Thanked 23 Times in 20 Posts
    Rep Power
    21

    thanks

    thanks guys for the help

  16. #15
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    25
    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:-
    Code:
    <form action="http://mail.server/login.aspx" method="get" name="maillogin">
    <input name="username" type="hidden" value"firstname@schoolname.sch.uk"/>
    <input name="password" type="password" /><input name="Login" type="submit" value="Login" />
    </form>
    Would ask for a password and pass it on to the server with "firstname@schoolname.sch.uk" 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.

  17. Thanks to limbo from:

    farmerste (1st February 2010)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Bulk update of Active Directory user info
    By Geoff in forum Windows
    Replies: 31
    Last Post: 14th June 2013, 04:04 PM
  2. Replies: 10
    Last Post: 11th May 2010, 10:13 AM
  3. Allow Website 1 User
    By karldenton in forum Windows
    Replies: 3
    Last Post: 3rd December 2008, 04:19 PM
  4. Second user equipment website - RDC
    By drjturner in forum Recommended Suppliers
    Replies: 7
    Last Post: 3rd July 2006, 10:47 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •