Solved

I can't read two parameters from a querystring!!

Posted on 2006-06-15
6
252 Views
Last Modified: 2008-02-26
Hi Guys,
I have an hyperlink in a datagrid that calls the MainFrame page with two parameters like this

http://localhost/InsertVouchers/MainFrameVP.aspx?VVoucherNum=12341234075380&VMod=VP

In the page_Load I'm receiving the parameters with
string VVoucher = Request.QueryString["VVoucherNum"];      
string VOption = Request.QueryString["VMod"];      

The problem is that VOption doesn't have any information it's null but I can see that in the URL the parameter VMod has information. What could be happening???
Help Please !!!!
Thanks
Carol




0
Comment
Question by:Carolinat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16913246
Is this ASP or ASP.NET?
0
 
LVL 6

Expert Comment

by:inviser
ID: 16913600
if this is asp then it needs to look like this. ASP does not support variable type binding (e.g. strings, ints, etc.). All variables are generic in type. Also, the request.queryString method uses ( ) instead of [ ].

dim VVoucher, VOption

VVoucher = Request.QueryString("VVoucherNum")  
VOption = Request.QueryString("VMod")    
0
 
LVL 6

Expert Comment

by:inviser
ID: 16913639
After the fact I realize your page is probably ASP.NET because of the .aspx extension in the URL you posted. In that case, it would look like this:

Dim VVoucher As String = Request.QueryString("VVoucherNum")  
Dim VOption As String = Request.QueryString("VMod")    
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Accepted Solution

by:
jrram earned 250 total points
ID: 16913756
>> inviser

It looks like she is coding in C# if it makes a difference.

>>  Carolinat

a. Are you getting a value back from your first parameter?
b. Have you tried reading the 2nd parameter first to see if it makes a difference.
c. Try this and see if it works
    string VOption = Request.QueryString.GetValues("VMod")[0];
0
 
LVL 12

Assisted Solution

by:ullfindsmit
ullfindsmit earned 250 total points
ID: 16914197
not an expert @ C# but try this


string VVoucher = (String) Request.QueryString["VVoucherNum"];    
string VOption = (String) Request.QueryString["VMod"];  

basically teh request.querystring returns an object

also try this
string VVoucher = (String) Request["VVoucherNum"];    
string VOption = (String) Request["VMod"];  

hope this helps

0
 

Author Comment

by:Carolinat
ID: 16922801
Guys, I'm developing with ASP and c#.

jrram

a. Are you getting a value back from your first parameter? ****yes
b. Have you tried reading the 2nd parameter first to see if it makes a difference.** Yes, I did it and still doesn't show anything in the variable VMod.
c. Try this and see if it works
    string VOption = Request.QueryString.GetValues("VMod")[0];
    ***It shows an error

 ullfindsmit
string VVoucher = (String) Request["VVoucherNum"];    
string VOption = (String) Request["VMod"];  
** I tried both options and neither one works

Any other idea????
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question