Results 1 to 10 of 10

Thread: ASP AddressBar

  1. #1

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446

    ASP AddressBar

    Hi
    I have been trying to find a good solution But i could't get

    My problem is I have developed the one Application using Asp.
    It has softmenu page for all forms (main menu page ).It the user
    go to the form by the way of softmenu it will work fine. But the thig is
    once he know about the file names he can directly enter the name in Address bar
    then the form will work with errors.
    How to control this. the User never ever Get a chance to enter into the form
    through entring the file name. I hope some had a solution
    Please help me.
    prasad

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    A malicious user can request known or random resources from your server - there's really not much you can do about it.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    New Member
    Join Date
    Jun 2002
    Location
    Bonnie Doon, AU
    Posts
    4
    Not much? How about checking for referrer or session? I suggest the former;

    Code:
    If Request.ServerVariables("HTTP_REFERER") = "your page" Then
    spit out page / code
    Else
    Response.Write "Access Denied"
    End If
    my weeds have sprouted

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Originally posted by raymo
    Not much? How about checking for referrer or session? I suggest the former;

    Code:
    If Request.ServerVariables("HTTP_REFERER") = "your page" Then
    spit out page / code
    Else
    Response.Write "Access Denied"
    End If
    This is trivial to get around...
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5
    New Member
    Join Date
    Jun 2002
    Location
    Bonnie Doon, AU
    Posts
    4
    True, but it's a good start. However what malicious user would want to enter the filename directly when they will be denied (assuming your page already has authentication code.. )?
    my weeds have sprouted

  6. #6

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    I have used
    Code:
    window.location.href="page.asp";
    in many of my pages, which redirects to the same page.

    So in this case,
    Request.ServerVariables("HTTP_REFERER") returns nothing.
    So I can't use Request.ServerVariables("HTTP_REFERER") either.
    Please help.
    prasad

  7. #7
    New Member
    Join Date
    Jun 2002
    Location
    Bonnie Doon, AU
    Posts
    4

    need more info

    I don't understand what you're trying to accomplish.
    Why do you have a redirect to the same page?
    my weeds have sprouted

  8. #8

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    In my ASP file has some Calculation. So I need to Refresh the
    Page to Get the values from Database OnClick of Calculate button.

    In this case i will be getting the

    --> Response.Write "Access Denied" Statemnet.

    How to do this?
    prasad

  9. #9
    New Member
    Join Date
    Jun 2002
    Location
    Bonnie Doon, AU
    Posts
    4
    Okey, please post all relevent code so we can help you.
    my weeds have sprouted

  10. #10

    Thread Starter
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446

    Here is my Code

    --------------frmMain.asp-----------------
    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <SCRIPT LANGUAGE=javascript>
    <!--
    function GoForm(fileName)
    {
    document.frmMain.action=fileName
    document.frmMain.submit();
    }
    //-->
    </SCRIPT>

    </HEAD>
    <BODY>
    <form name="frmMain">
    <Input type=button name="form1" Onclick=GoForm('frmPostings.asp')>
    <Input type=button name="form2" Onclick=GoForm('frmForm2.asp')>
    <Input type=button name="form3" Onclick=GoForm('frmForm3.asp')>
    <Input type=button name="form4" Onclick=GoForm('frmForm4.asp')>

    </form>
    </BODY>
    </HTML>


    --------------frmPostings.asp-----------------
    <%@ Language=VBScript %>
    <%
    Set Conn=server.CreateObject("Adodb.Connection")
    Conn.Open Session("ConStr")

    If Request.Form("OnLoadStatus")="Sorting"
    Sql="Select * from MyTable Order By "& Request.Form("cboSort")
    Else
    Sql="Select * from MyTable"
    End if

    Set Rs=server.CreateObject("Adodb.Recordset")
    rs.Open Sql,conn

    OnLoadSt=Request.Form("onLoadStatus")
    ' Here i will get Status of Form Inserting or Editing
    %>
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <SCRIPT LANGUAGE=javascript>
    MyLoadSt="<%=OnLoadSt%>"

    <!--
    function goClick()
    {
    document.frmPost.OnLoadStatus="Sorting";
    document.frmPost.action="frmPostings.asp"
    document.frmPost.submit();
    }
    //-->
    </SCRIPT>

    </HEAD>
    <BODY OnLoad="DefaultStatus()">
    <form name="frmPost">
    <%
    Response.Write "<Table>"
    Do while Not Rs.eof
    Response.Write "<tr>"
    Response.Write "<td>"& rs.Fields(0) "&</td>"
    Response.Write "<td>"& rs.Fields(1) "&</td>"
    Response.Write "<td>"& rs.Fields(2) "&</td>"
    .....
    Response.Write "</tr>"
    Loop
    Response.Write "</Table>"
    %>

    <select name="cboSort" size="1">
    <option value="ID">Id </option>
    <option value="Name">Name</option>
    <option value="CardNo">CardNo</option>
    </select>
    <input type="Button" name="btnGo" value="Go" OnClick="goClick()">
    <input type="Hidden" name="OnLoadStatus">

    </form>
    </BODY>
    </HTML>
    prasad

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