开发者

In ASP, what is the best way to save request variables to a frame <frame src="SomeOther.asp"

I have a main page with a frame with its attribute src set to equal "SomeOther.asp".

Since I have some rather large request variables, I want to save my request variables from my current page into my SomeOther.asp frame. Is there a way to transfer my request variables to my frame's page? The reason is b/c in my SomeOther.asp I can't really use query string for all variables b/c one is a bunch of 1,2,3,4,5,..... 4000 more of them which represents IDs, and I开发者_如何学Python'd rather not use cookies, but I can use request object, or perhaps a session variable.

If I can't use request attributes I am planning on using a session variable and just transferring the name of this variable in a query string ie... <frame src="SomeOther.asp?mysess=uniquesessionname ...

Here is my workflow page1 form loaded, submit button hit, from data submitted to post to page2. Page2 automatically calls page3 with query string data. Page3 has the frame on it. I can access the request input items from page1 on page3, but not on page3's frame. This is what I'm trying to do.

Thanks.


You can try by post method on same page as src of Ifram.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
    <form action="v.asp" method="post">
    <iframe src="v.asp"></iframe>
    <input type="text"  name="txt1" value="123" />
    <input type="submit" value="click" />
  </form>
</body>
</html>


You can transfer your querystring to the iframe using JavaScript:

document.frames[0].src="SomeOther.asp?" + document.location.pathname


You may want to clarify what you mean by request variables. Variables in query strings would generally be considered request variables but you say you can't use querystring... Do you mean you want to do them like form submission? And where are these variables coming from? Are they calculated in your asp page or are they external parameters passed to your parent page somehow?

You can set the target for a form submission to be an iframe in which case the response from the form will be displayed in the frame.

You can as others have suggested put the variables on the querystring but you suggest that might get too long.

If they are starting off on the server then storing them on the server is sensible. If in session you can either store each of the variables in an equivalent session variable. This will cause problems if the user has multiple copies of the page open.

You can do as you suggest and store all the variables under a single unique session key and then pass that as the single querystring parameter.

Lastly you could store the state into a persistent medium such as a database and use the id of that in your frame querystring to retrieve it. This may be better than storing in session depending on the size of what you are storing, volume of traffic, etc. Generally it can be a very bad idea to store anything too large in session due to the amount of memory you may start eating up if you aren't careful.

Without more details it is hard to say what will be best for your scenario but hopefully the above should give you some ideas on where you can go with it.


Is it absolutely necessary that you use a frame? If it's just to display a menu or special area only visible to a logged in user, you should really consider using CSS to create the "frame" effect then you won't need to pass your request variables to your frame or have to necessarily mess around with sessions just to pass information from one to the other.

Here are some examples:
http://fu2k.org/alex/css/frames/scalablefixed
http://www.webpelican.com/web-tutorials/css-frames-tutorial/

If the frame is necessary then I'd suggest going with sessions.


If you want to manipulate with the submited data within an iframe, why not use "target" attribute of the form tag to point to the iframe?

<form action="ProcessPage.asp" target="iframeName">
     ....all your inputs...
</form>
<iframe name="iframeName"></iframe>


To the best of my knowledge it is possible to bind query string variables inside of frame elements:

<frame src="SomeOther.asp?someid=5&mode=2"/>

AFAIK, HTML treats all URLs the same and so frames can contain the same query string data as normal Page URLs have. Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜