Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2011
    Posts
    10

    Unanswered: General Question - To get the URL of parent window

    Hi Everyone,
    I am new to classic ASP.I have a general question.
    I have to get the url of the parent page in my asp page.
    Is there any way to get the Parent window's url in asp.


    I Know that the value could be obtained in javascript using window.parent.location.href ,then stored in a hidden variable
    and could obtain it using Request.Form .But this solution requires the form to be submitted I don't want that to happen.

    And even Request.ServerVariables(HTTP_Referer) does not work since my page opens in a new window.

    Any Ideas ??
    Any Suggestions??

    Thanks in Advance

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    From within ASP you can't. You have to use javascript.

    Having said that, if it is the "click a button and submit" part you are concerned about you can also grab the data and then do a client side redirect or an javascript post to get the information.

    What are you actually trying to do? Detect if you are wrapped in another window and break out??

  3. #3
    Join Date
    Feb 2011
    Location
    Indore India
    Posts
    2

    Post I suggest....

    I suggest you to switch to ASP.NET 4.0. The classic ASP does not have many features that are provided in ASP.NET.

    In ASP.NET you can get the URL directly so it is no big issue there.

    Regards
    Market Research

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Even if you switch to 4.0 you would still have to use a client side javascript to grab the URL of a parent window. The core functions of ASP happen on the server, not on the client. When you use the built in client controls you should see links to client side javascript that is actually doing the work.

  5. #5
    Join Date
    Sep 2006
    Posts
    265
    You could try setting a Session Variable at the Parent asp form before you open a New Form.

    Simon

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Assuming you have control over that parent window,....

    Really it depends what situation the OP is actually trying to resolve and as they haven't posted back since the first post I'd have to assume it's resolved or not really that criticial.

Posting Permissions

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