millenniasp Posted November 25, 2003 Posted November 25, 2003 A little backround. We are currently re-creating our inhouse Access 2000 application into an ASP.NET intranet application. We are starting with recreating all of our reports into Crystal reports. I have created a user button that will pull up the asp.net application from Access with the following url. My question is how do I get the parameters that I am passing into my global aspx file? I was able to do it when I was calling an aspx page, but when I switch to htm page I cannot see where I can get these parameters. here is the string url http ://localhost/CrystalPrototype/Main.htm?ClientID=W73037&UserID=Millini%20Wills any help would be greatly appreciated! Quote
Moderators Robby Posted November 25, 2003 Moderators Posted November 25, 2003 Are you talking about "ClientID" ? If so then .. dim s as string = Request.QueryString("ClientID") Quote Visit...Bassic Software
millenniasp Posted November 25, 2003 Author Posted November 25, 2003 I put that in and this is the error I got: Request is not available in this context here is my code in the global aspx file 'This call is required by the Component Designer. InitializeComponent() myClientID = Request.QueryString("ClientID") myUserID = Request.QueryString("UserID") Quote
Threads Posted November 25, 2003 Posted November 25, 2003 You are going to need to use Request from the pages that need it and not from global.aspx. It isn't available from that context Quote mov ax, 13h int 10h
millenniasp Posted November 25, 2003 Author Posted November 25, 2003 In the page_init of the page that is calling for these variables here is the code Try myClientID = (Request.QueryString("ClientID")) '"W73058" myUserID = (Request.QueryString("UserID")) TextBox1.Text = myClientID Catch ex As Exception Dim errcode As String errcode = ex.ToString Label3.Text = errcode End Try I recieve no error, but the variables are set to nothing. Quote
Moderators Robby Posted November 25, 2003 Moderators Posted November 25, 2003 Put it in the page_load Quote Visit...Bassic Software
millenniasp Posted November 25, 2003 Author Posted November 25, 2003 still doesn't work. Perhaps (um yeah) I should have mentioned that the aspx that the variables need to be set from, are inside the frame on the Main.htm page. Like I said earlier, the passing of the parameters worked until I put this page into a frame. Quote
millenniasp Posted November 25, 2003 Author Posted November 25, 2003 I figured out how to do this, I am going to post it here in case anyone else comes across this situation. First I created a new aspx page and copied the HTML from my "main.htm" page that I was passing the parameters to. I reset my code in Access to reflect this. I then put this code in my global.asax page Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the session is started Session("params") = Request.Params End Sub I then placed this code in the page that needed the parameters Try myClientID = (Session("params"))("ClientID") myUserID = Session("params")("UserID") TextBox1.Text = myClientID Label4.Text = myUserID Catch ex As Exception Dim errcode As String errcode = ex.ToString Label3.Text = errcode End Try Best of all it works!!!! YAY! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.