Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    Hello,
    I am in desperate need of some help here.
    I need to pass my username (uName) value from this authorization code to
    my client page. When the clients username and password are authorized as
    valid they are being sent to the client page with this line of code:
    Response.write("<SCRIPT Language=JavaScript>window.location =
    \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");

    I am trying to attach the value with this:
    clientnewstest1.asp?rmemeid=uName and its not working, I'm not
    experienced with using queries ect.. and I cannot get the syntax right!

    If anyone can help me with this I would greatly appreciate it. Thanks in
    advance :+)

    <%
    var conn;
    var rs;
    var sSQL;

    conn=Server.CreateObject("ADODB.Connection");
    rs=Server.CreateObject("ADODB.Recordset");
    conn.Open("cpWebdata");

    sSQL = "SELECT InvestorAdmin.*";
    sSQL += " FROM InvestorAdmin ";
    sSQL += " WHERE MemberID = '" + Request.Form("uName") + "' ";
    sSQL += " AND MemberPW = '" + Request.Form("uPass") + "';";


    rs=Server.CreateObject("ADODB.Recordset");
    rs.Open(sSQL, conn);
    //Response.write(sSQL);

    if (!rs.eof) {

    var rmemeid;
    rmemeid = rs("MemberID");
    //Response.write(rmemeid);
    //var memid;
    //memid = Request.form("uName");
    //Response.write(memid);
    Response.write("<SCRIPT Language=JavaScript>window.location =
    \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");

    } else {
    //Not a valid username or password
    Response.write("<SCRIPT Language=JavaScript>window.location =
    \"loginportfolio.asp\";</SCRIPT>");


    rs.close();
    conn.close();
    rs=null;
    conn=null;
    }
    %>
    ============================
    Miranda Johnsen
    [url]www.mirandajohnsen.com[/url]
    ===========================
    "Every worthwhile accomplishment, big or little, has its stages of
    drudgery and triumph; a beginning, a struggle and a victory."
    Ghandi

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Miranda johnsen Guest

  2. Similar Questions and Discussions

    1. How to send files to client
      Hi, Does anyone know how to send a file to the client from Flex. My scenario is this: 1) Pass some parameters to java layer 2) Java layer...
    2. Help Urgent, How to get hashed pwd in web service when send in username token as SendHashed
      Hi, I am sending username and pwd in usernametoken in SendHashed format, While in web service, i am getting Nothing in that UsernameToken's...
    3. NT Client Username
      > Does anyone know of a way of finding the client's username using PHP. Hi, The following server variables (like HTTP_REFERER) should help you:...
    4. Webservice over HTTPS. How to choose certicicate and send username nad password???
      Webservice over HTTPS. How to choose certicicate and send username nad password??? Now i'm getting connection errors saying that the ssl...
    5. send page to client when session expires
      A client-side timer fires and does the page redirect - you can't do it from global.asa since there is no page request context to redirect.with when...
  3. #2

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    Uname, memid, rmemeid? I feel bad for anyone that has to inherit this
    code...
    > Response.write("<SCRIPT Language=JavaScript>window.location =
    > \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
    Why do you need client-side JavaScript to do this? How about:

    Response.Redirect('../clientside/clientnewstest1.asp?rmemeid=' +
    Request.Form("uName"));

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    <%
    Response.write("<SCRIPT Language=JavaScript>window.location =
    '../clientside/clientnewstest1.asp?rmemeid=" + uName + "';</SCRIPT>");
    %>

    Or, to see it in a simpler way:

    <%
    var uName = Request.Form("uName");
    var sHref="../clientside/clientnewstest1.asp?rmemeid="+uName;
    Response.write("<script language=javascript>");
    Response.write("window.location='" + sHref + "';");
    Response.write("</script>");
    %>

    Ray at work


    "Miranda johnsen" <info@mirandajohnsen.com> wrote in message
    news:eqWeWvBwDHA.1740@TK2MSFTNGP12.phx.gbl...
    > Hello,
    > I am in desperate need of some help here.
    > I need to pass my username (uName) value from this authorization code to
    > my client page. When the clients username and password are authorized as
    > valid they are being sent to the client page with this line of code:
    > Response.write("<SCRIPT Language=JavaScript>window.location =
    > \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
    >
    > I am trying to attach the value with this:
    > clientnewstest1.asp?rmemeid=uName and its not working, I'm not
    > experienced with using queries ect.. and I cannot get the syntax right!
    >
    > If anyone can help me with this I would greatly appreciate it. Thanks in
    > advance :+)
    >
    > <%
    > var conn;
    > var rs;
    > var sSQL;
    >
    > conn=Server.CreateObject("ADODB.Connection");
    > rs=Server.CreateObject("ADODB.Recordset");
    > conn.Open("cpWebdata");
    >
    > sSQL = "SELECT InvestorAdmin.*";
    > sSQL += " FROM InvestorAdmin ";
    > sSQL += " WHERE MemberID = '" + Request.Form("uName") + "' ";
    > sSQL += " AND MemberPW = '" + Request.Form("uPass") + "';";
    >
    >
    > rs=Server.CreateObject("ADODB.Recordset");
    > rs.Open(sSQL, conn);
    > //Response.write(sSQL);
    >
    > if (!rs.eof) {
    >
    > var rmemeid;
    > rmemeid = rs("MemberID");
    > //Response.write(rmemeid);
    > //var memid;
    > //memid = Request.form("uName");
    > //Response.write(memid);
    > Response.write("<SCRIPT Language=JavaScript>window.location =
    > \"../clientside/clientnewstest1.asp?rmemeid=uName\";</SCRIPT>");
    >
    > } else {
    > //Not a valid username or password
    > Response.write("<SCRIPT Language=JavaScript>window.location =
    > \"loginportfolio.asp\";</SCRIPT>");
    >
    >
    > rs.close();
    > conn.close();
    > rs=null;
    > conn=null;
    > }
    > %>
    > ============================
    > Miranda Johnsen
    > [url]www.mirandajohnsen.com[/url]
    > ===========================
    > "Every worthwhile accomplishment, big or little, has its stages of
    > drudgery and triumph; a beginning, a struggle and a victory."
    > Ghandi
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  5. #4

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    NEVER MIND - I FINALLY GOT IT :+)
    ..AFTER TRYING 10,000 DIFFERENT THINGS :+S

    Miranda Johnsen
    [url]www.mirandajohnsen.com[/url]
    ===========================
    "Every worthwhile accomplishment, big or little, has its stages of
    drudgery and triumph; a beginning, a struggle and a victory."
    Ghandi

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Miranda johnsen Guest

  6. #5

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    Well, that just further proves it then.
    Every worthwhile accomplishment, big or little, has its stages of
    drudgery and triumph; a beginning, a struggle and a victory."

    Ray at work

    "Miranda johnsen" <info@mirandajohnsen.com> wrote in message
    news:e1mKULCwDHA.3536@tk2msftngp13.phx.gbl...
    > NEVER MIND - I FINALLY GOT IT :+)
    > .AFTER TRYING 10,000 DIFFERENT THINGS :+S
    >
    > Miranda Johnsen
    > [url]www.mirandajohnsen.com[/url]
    > ===========================
    > "Every worthwhile accomplishment, big or little, has its stages of
    > drudgery and triumph; a beginning, a struggle and a victory."
    > Ghandi
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  7. #6

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    Hi Aaron, i know my variables were messy. I've cleaned them up and only
    kept one as they were created during my madness. I was thinking
    response.redirect, but could'nt find any examples.
    I ended up with:
    Response.write("<SCRIPT Language=JavaScript>window.location =
    \"../clientside/mic1sharetransactions.asp?MemberID='" +
    Request.Form("uName") + "'\";</SCRIPT>");

    and then on the client page, grabbing it with:

    var member_id;
    member_id = Request.QueryString("MemberID");

    sSQL = "SELECT *";
    sSQL += " FROM MIC1Shares, Investors, InvestorAdmin";
    sSQL += " WHERE InvestorAdmin.MemberID = " + member_id;
    sSQL += " AND Investors.MemberID = " + member_id;
    sSQL += " ORDER BY MIC1Shares.DateIssued DESC;";




    Miranda Johnsen
    [url]www.mirandajohnsen.com[/url]
    ===========================
    "Every worthwhile accomplishment, big or little, has its stages of
    drudgery and triumph; a beginning, a struggle and a victory."
    Ghandi

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Miranda johnsen Guest

  8. #7

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    > Response.write("<SCRIPT Language=JavaScript>window.location =

    Still don't understand why you're going to force JavaScript here. William
    Tasso, for one, won't be able to use your site.

    However, if you're going to insist on using client-side script, at least do
    it right for possible future compatibility issues... window.location is not,
    in and of itself, a property, so:

    Response.write("<SCRIPT Language=JavaScript>window.location.href =

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

  9. #8

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)


    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
    news:ejwnPaDwDHA.3144@tk2msftngp13.phx.gbl...
    > Still don't understand why you're going to force JavaScript here. William
    > Tasso, for one, won't be able to use your site.
    You're full of the old-post humor today. :]

    Ray at work


    Ray at Guest

  10. #9

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    Thanks Ray!
    I experienced an extra dose of drudgery and struggle with this one, but
    victory sure made me dance :+P

    Miranda Johnsen
    [url]www.mirandajohnsen.com[/url]
    ===========================
    "Every worthwhile accomplishment, big or little, has its stages of
    drudgery and triumph; a beginning, a struggle and a victory."
    Ghandi

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Miranda johnsen Guest

  11. #10

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    Hi Aaron,
    I am going to convert to Response.redirect :+)
    I've run into another problem though:

    One more question :+)
    ok, so now I have my value passing. But, because I have so much data, I
    want to break it up into different pages. So I need to create some links
    that again pass the value.

    =========== This is what I've done =====================

    <%
    var conn;
    var rs;
    var sSQL;

    conn = Server.CreateObject("ADODB.connection");
    conn.Open("cpWebdata");

    var memid;
    memid = Request.QueryString("MemberID");

    sSQL = "SELECT *";
    sSQL += " FROM MIC1Shares, Investors, InvestorAdmin";
    sSQL += " WHERE Investors.MemberID = " + memid+";";


    rs=Server.CreateObject("ADODB.Recordset");
    rs.Open(sSQL,conn);
    Response.write(sSQL);

    %>

    <a href=mic1shares.asp?MemberID=<%=rs("MemberID")%>'> Mic1 shares</a>
    ...etc
    ================== testpass.asp =========================

    <%
    var conn;
    var rs;
    var sSQL;

    var memid;
    memid = Request.QueryString("MemberID");

    conn = Server.CreateObject("ADODB.connection");
    conn.Open("cpWebdata");


    sSQL = "SELECT *";
    sSQL += " FROM MIC1Shares, Investors, InvestorAdmin";
    sSQL += " WHERE InvestorAdmin.MemberID = " + memid;
    sSQL += " AND Investors.MemberID = " + memid +";";

    rs=Server.CreateObject("ADODB.Recordset");
    rs.Open(sSQL,conn);
    Response.write(sSQL);
    Response.write(rs("InvestorName"));

    %>
    ================================================== =

    This is sent thru:
    [url]http://localhost/clients/CooperPacific/www/clientside/testpass.asp?Membe[/url]
    rID=CP00020

    ============== AND THIS IS THE ERROR i GET ============
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected
    1.
    /clients/CooperPacific/www/clientside/testpass.asp, line 182
    ================================================== =======

    Thanks,
    Miranda Johnsen
    [url]www.mirandajohnsen.com[/url]
    ===========================
    "Every worthwhile accomplishment, big or little, has its stages of
    drudgery and triumph; a beginning, a struggle and a victory."
    Ghandi

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Miranda johnsen Guest

  12. #11

    Default Re: Send Username value to client page (clientnewstest1.asp?rmemeid=uName)

    > sSQL += " WHERE Investors.MemberID = " + memid+";";

    Is MemberID text or numeric? If it's text, then you need to treat the
    literal as a string. You can do this by surrounding it with single quotes.

    sSQL += " WHERE Investors.MemberID = '" + memid+"';";

    Otherwise, it looks like this:

    .... WHERE Investors.MemberID = someTextValue

    Which makes it think that someTextValue is a column name, and of course it
    can't find that column in your table.

    BTW if this is the case, then that's a poor name, IMHO -- ID usually implies
    numeric data. Oh, and you'll want to prevent SQL injection attacks by
    doubling up apostrophes within the string, e.g. try out
    page.asp?memberID=o'toole

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand - MVP Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139