Send value from a asp.net page to a regular asp page..

M

msnews

I am collecting a value in a textbox on an asp.net page and need to open an
asp page and pass the variable containing the value or just the value to
that asp page so I can use it in the vbscript as an arguement


be gentle.. I'm new to this..


PS. I have not been able to convert the ASP page to ASP.net, but that's for
a different post.
 
J

John Timney \(ASP.NET MVP\)

might be a silly quation, why cant you just use an html page and pass it via
a typical form post of get?

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
M

msnews

The asp.net page will have a few controls on it.. most I think are unique to
..net.

I'm looking at response.redirect, but I don't understand how you select
which value to send..
 
A

arunprakashb

One possible solution could be to send it in query string. Something
like this

Response.Redirect("Yourpage.asp?YourVariable=YourValue");

Or you could add a hidden variable in the asp.net page and then set its
value before opening up the asp page.
 
M

msnews

I assume that code would go in the asp.net page.

Can you give an example of how I was then "read" that value in the ASP page
so I can use it. It looks exactly like what I need..
 
A

arunprakashb

yeah.. the above code would go in the asp.net code behind file.

In the asp page, you could retrieve it like this
myvalue = Request.QueryString("YourVariable")
 
M

msnews

It looks so easy but I am getting nowhere.. here is some code

from the asp.net page

'machinename is the vaue I want to pass..
machinename = TextBox1.Text

Response.Redirect("machrest.asp?machinename=" & machinename)

In the asp page

machinename = Request.QueryString("machinename")

Sub FillInCollections
dim CompName,oWshShell


set oWshShell = CreateObject("WScript.Shell")
path = "\\" & "wchsms13" & "\remote$\remote.exe"
oWshShell.run path & " 2 " & machinename

end Sub



I don't see the parameter in the URL when the ASP page opens..



it should launch a commandline that looks like this

\\wchsms13\remote$\remote.exe 2 machinename
 
A

arunprakashb

Am sorry am not of much help beyond this. Here is some actual code that
i wrote and tested. It worked fine for me.

In webform1.aspx.cs

string s = "myvalue";
Response.Redirect( "WebForm2.aspx?myvariable=" + s );

In webform2.aspx.cs

Response.Write( Request.QueryString["myvariable"] );

( I've used aspx as my target, i dont think this makes any difference ).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top