internet explorer cannot read post data from form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JohnathanKong
    New Member
    • Oct 2007
    • 1

    internet explorer cannot read post data from form

    Hello, I hope this is the right place to post, but anyways, here goes. I current have a forum, snitz, in place, but am having an IE specific problem. Basically what happens is, I have a page that drops a cookie which logs in the user. This all works fine, but once the cookie is dropped ALL post method data from forms become empty. Get works, and if I post data to a different site it works, so the break down is reading the data from the post. Here is the code that logs the user into the site:

    <!--#INCLUDE FILE="config.as p"-->
    <!--#INCLUDE FILE="inc_func_ common.asp"-->
    <%
    dim rsUser, conn

    if len(Mid(Request .ServerVariable s("AUTH_USER" ), Instr(1, Request.ServerV ariables("AUTH_ USER"), "\") + 1)) > 0 and not strLoginStatus = 1 then
    set conn = Server.CreateOb ject("ADODB.CON NECTION")
    set rsUser = Server.CreateOb ject("ADODB.REC ORDSET")

    conn.Open strConnString

    rsUser.Open "SELECT m.M_PASSWORD FROM glbPermissions p INNER JOIN FORUM_MEMBERS m ON p.id = m.M_FITS_ID WHERE p.loginName='" & lcase(Mid(Reque st.ServerVariab les("AUTH_USER" ), Instr(1, Request.ServerV ariables("AUTH_ USER"), "\") + 1)) & "'", conn

    if not rsUser.EOF then
    strDBNTUserName =trim(Mid(Reque st.ServerVariab les("AUTH_USER" ), Instr(1, Request.ServerV ariables("AUTH_ USER"), "\") + 1))
    strEncodedPassw ord = rsUser("M_PASSW ORD")

    if strSetCookieToF orum = 1 then
    Response.Cookie s(strUniqueID & "User").Pat h = strCookieURL
    else
    Response.Cookie s(strUniqueID & "User").Pat h = "/"
    end if
    Response.Cookie s(strUniqueID & "User")("Na me") = strDBNTUserName
    Response.Cookie s(strUniqueID & "User")("Pword" ) = strEncodedPassw ord
    'Response.Cooki es(strUniqueID & "User")("Cookie s") = Request.Form("C ookies")
    if fSavePassWord = "true" then
    Response.Cookie s(strUniqueID & "User").Exp ires = dateAdd("d", intCookieDurati on, strForumTimeAdj ust)
    end if
    Session(strCook ieURL & "last_here_date ") = ReadLastHereDat e(strDBNTFUserN ame)

    strLoginStatus = 1
    end if

    rsUser.Close

    conn.Close
    end if

    if Len(Request.Que ryString("targe t")) > 0 then
    Response.Redire ct "login.asp? " & Request.QuerySt ring("target")
    else
    Response.Redire ct "default.as p"
    end if
    %>

    All the previous code does is create the cookies. The variables are declared on one of the included pages. Once this code is executed, nothing works. I have created a simple asp page that just reads posted data which does not work once I use the above page:

    <html>
    <head>
    </head>
    <body>
    <%=Request("tes t")%>

    <form method="post" action="test.as p">
    <input type="text" name="test" />
    <input type="submit" value="submit" />
    </form>
    </body>
    </html>

    Before I log in, the above code will echo everything in the box, but after I log in, it receives nothing. I have tested this log in feature on firefox, and it works fine, but on ie, it just refuses to work. Hopefully someone can shed some insight onto this, because I've been at this for 2 days, and have made no progress.
  • markrawlingson
    Recognized Expert Contributor
    • Aug 2007
    • 346

    #2
    The request object is a tricky thing because it refers to more than 1 collection. Generally it's a good idea to specify exactly which collection you're requesting information from instead of just using Request("test") - this could mean it's coming from cookies, the qstring, or the form - and ASP doesn't know which. It just looks for the first cookie, querystring value, or form value named "test"

    Try specifying Request.Form("t est") and see if that solves the problem.

    I'm wondering whether or not you messed around with cookies before you wrote this script.. for instance, did you write a simple script to play around with cookies on your computer? And if so, did you set the name of that cookie to "test"... Because that would make a whole lot of sense :P

    I also noticed that when you pass people to login.asp there's a small problem...

    [CODE=asp]
    if Len(Request.Que ryString("targe t")) > 0 then
    Response.Redire ct "login.asp? " & Request.QuerySt ring("target")
    else
    Response.Redire ct "default.as p"
    end if
    [/CODE]

    The querystring value of "target" is passed along to the next page but it doesn't have an identifer, so if you tried to say... Request.QuerySt ring("target") on the next page it would return null.

    [CODE=asp]
    if Len(Request.Que ryString("targe t")) > 0 then
    Response.Redire ct "login.asp?targ et=" & Request.QuerySt ring("target")
    else
    Response.Redire ct "default.as p"
    end if
    [/CODE]

    Sincerely,
    Mark

    Comment

    Working...