Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:08:21+00:00 2026-06-03T14:08:21+00:00

I created a page in ASP that loads dynamic content with code similar to

  • 0

I created a page in ASP that loads dynamic content with code similar to this:

<%
  var1 = int(rnd * 5) + 1
  var2 = int(rnd * 10) + 1
%>
<html>
<body>

what variable 1 is: <%=var1%>
what variable 2 is: <%=var2%>

</body>
</html>

Then I have another page that uses Server.Execute to execute the previous file mentioned 2+ times using a loop. The code looks like this:

<% filename = request.querystring("page") %>

<table class="domtable">
<% for j = 1 to 2%> <%qnumb = qnumb + 1%>
  <tr> 
      <td align="left">
        <%server.execute (filename)%> 
        <% If qnumb < 2 then%>
        <br/><hr><br/>
        <%end if%>
      </td></tr>
  <%next%>
</table>

So for the last couple of months this has been working perfectly for me, loading different numbers for both variables on the two separate executions. Then today, I duplicated a folder on my server, renamed it and now magically, the variables are the same number about 9 out of 10 times the browser is refreshed.

This happened to me with the same files on my second server a month ago, and I had to delete all the files off of the second server, and download them from my first server (the one duplicating now), then upload them back and that fixed it. Unfortunately, I didn’t download the entire server contents of my first server so I’m unable to reverse the process. So I’m not sure if this issue is server-side, or if it’s related with the code I’m writing? I just don’t know why it would work for so long then just stop working out of nowhere.

I’ve tried using meta no-cache controls. I deleted the new folder I duplicated earlier from the server and that didn’t work. I also tried deleting files from the last couple days that have been uploaded and that didn’t work either. I’ve tried loading ‘filename’ as an array such as:

filename(1) = request.querystring("page")
filename(2) = request.querystring("page") 

for j = 1 to 2
  Server.Execute(filename(j))

next

I really hope someone knows what I’m doing wrong here.

-EDIT-

I’m also doing this and getting the same results.

<%
'rnd.asp'
pStr = "private, no-cache, must-revalidate" 
Response.ExpiresAbsolute = #2000-01-01# 
Response.AddHeader "pragma", "no-cache" 
Response.AddHeader "cache-control", pStr
server.execute ("rndj.asp")
response.write ("<hr>")
randomize(3)
server.execute ("rndj.asp")
%>

<%
'rndj.asp'
pStr = "private, no-cache, must-revalidate" 
Response.ExpiresAbsolute = #2000-01-01# 
Response.AddHeader "pragma", "no-cache" 
Response.AddHeader "cache-control", pStr
randomize
response.write rnd
response.write "<br>"
response.write rnd
%>

I started to use this code below which looks at the specified file as plain text and removes the asp tags from it then uses Execute to run it within the original file. The problem with this is all my pages that i call use in them for other resources and the replace script wont let me add asp tags around the include lines.

<%
Dim sTargetFile, sTargetFileContents
Dim oFSO, sContents

Function GetFileContentsForExecution(sTargetFile)

'Obtain a reference to the FileSystemObject
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")

'Obtain the file contents
sContents = oFSO.OpenTextFile(Server.MapPath(".") & "\" & sTargetFile).ReadAll
Set oFSO = Nothing 'reference to the FileSystemObject

'Remove the ASP scripting tags
rand = int(rnd * 2) 
sContents = Replace (sContents, "<" & "%", "")
sContents = Replace (sContents, "%" & ">", "")
GetFileContentsForExecution = sContents
End Function

sTargetFile = "rndj.asp"

for j = 1 to 6

'Get the contents of the file to execute
sTargetFileContents = GetFileContentsForExecution(sTargetFile)
Execute sTargetFileContents

next

if j < 3 then 
response.write ("<br/><hr><br/>")
end if
%>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:08:23+00:00Added an answer on June 3, 2026 at 2:08 pm

    Link to working solution

    <%
     'rnd.asp'
     randomize
    
     application("randomseed") = rnd
     server.execute ("rndj.asp")
    
     application("randomseed") = rnd
     server.execute ("rndj.asp")
    
    %>
    
    <%
     'rndj.asp'
     randomize application("randomseed")
     response.write rnd
     response.write("<br />")
     response.write rnd
     response.write("<br />")
     response.write("<br />")
    

    %>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics
I created a new ASP.NET MVC application. The home page looks like this: I
I have created a page that loads data from a query string. And creates
Currently I've created a ASP.Net page that has a dropdown control with autopostback set
I have a HTML page that I have created that essentially consists of: <div>
I have a listview that loads dynamic controls from xml/xslt <asp:ListView ID=DynamicFields runat=server DataSourceID=CustomFields
I'm using ASP.NET AJAX. I create a .aspx page that is based on a
I have a web application in Asp.Net. I've created my master page and inside
I create a asp.net page and test the code in debug mode step by
If you use dynamic pages like JSP or asp.net, you can have your page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.