Results 1 to 3 of 3

Thread: Easy Question on ASP

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 1999
    Location
    seattle, wa
    Posts
    23
    New to ASP. Can't quite figure out the following.

    HTP Page on CLIENT has a button and a textbox. User Clicks on button which runs CLIENT side script which request as ASP page on SERVER. The ASP page creates an active X object which does some processing and then returns to the ORIGINAL CLIENT page, a datastream (not HTTP formatted) which the CLIENT puts into the TextBox.

    Note: the ASP page is not supposed to display anything, only create and Active X SERVER object which will return to the requesting CLIENT page, information which it will use via CLIENT side server scripts.

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    See if I can help...

    are you trying to make a redirecting script? cause it's sounds like it...
    ngphuocthinh

  3. #3
    Guest
    If you requested a page from the server via http your gonna get back via http. This is what should happen with your page:

    Sample client side script(as seen before it is sent to the client, so it has some asp in it):
    Code:
    <%
    Dim strUserName
    strUserName = Trim(Request("UserName"))
    %>
    <html>
    <title>MyClientPage.asp</title>
    <body bgcolor="FFFFFF">
      <form name="MyHtmlForm" method="POST" action="MyAspProcessingPage.asp">
        <input type="text" size="20" name="UserName" value="<%= strUserName %>">
        <input type="submit" value=" Save ">
      </form>
    </body>
    </html>
    that should display a single textbox and a button with the word Save on it within the browser. Now let's say the user types in jack handy for the username and presses submit. The information will now be "posted" to the page "MyAspProcessingPage.asp" which might look like the following:

    Code:
    <%
    Dim strUserName, objYourActiveXServerObject
    
    strUserName = Trim(Request("UserName"))
    
    set objYourActiveXServerObject = _
      Server.CreateObject("ServerName.ClassName")
    
    ' let's say all your server component does is
    ' capitalize the first letter of each word using
    ' a wrapper around the VB6 built in function StrConv.
    
    strUserName = objYourActiveXServerObject.MyStrConv(strUserName)
    
    Set objYourActiveXServerObject = Nothing
    
    ' Now send the newly formatted username back 
    ' to the same page you started out with.
    Response.Redirect "http://server/MyClientPage.asp?UserName=" & _
    Server.URLEncode (strUserName)
    %>
    (fyi, StrConv is not available in VBScript, also, Request("UserName") is not a typo, depending on the circumstance it can be ok to not include .Form or .QueryString)

    so when the client page first starts it tries to get the username using the request object. It doesn't find it so when you first see the client page the box is empty.

    the user then types in the name jack handy and presses the submit button. Your server side only script, "MyAspProcessingPage.asp", will grab the username, your wrapper method, MyStrConv(which does one thing, capitalizes the first letter of every word), converts the username it was passed. Once complete it will send the new username back to the first page.

    when the first page tries to get the username this time it succeeds and displays Jack Handy in the text box.

Posting Permissions

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



Click Here to Expand Forum to Full Width