Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C sharp Request.QueryString error

Status
Not open for further replies.

sarad1978

Technical User
Jan 16, 2003
9
US
I am totally new to this but I get an error in VS2005 when I build the website that says "the name request does not exist in the current context"

I'm guessing I'm missing some reference to what would allow me to call the method but I can't find it on the web anywhere's.


public class clientXML
{
public const string member_num = "unknown";
public const string EmpLast = "unknown";
public const string FOLDER_PATH = ("C:\\Orderstatus\\TOCXML\\AutoDialer\\");
public static string LoadXML()
{
string LogFile = FOLDER_PATH + "PostLog\\StreamRec.txt";

string myResponse = "";
myResponse = "here";

string empnum="000";
string EmpLast = Request.QueryString("employee_identifier");
string member_num = Request.QueryString("member_number");

string Emp_PATH = FOLDER_PATH + empnum + "\\";
string emp_PATH = Emp_PATH + member_num +".mn";


FileStream fs = new FileStream(emp_PATH, FileMode.CreateNew, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
fs.Close();
return myResponse;
}


}
}
any hints would be greatly appreciated.
 
if this function is in a class file then you need
HttpContext.Current.Request.QueryString("employee_identifier");

etc.

Jim
 
'System.Web.HttpRequest.QueryString' is a 'property' but is used like a 'method'

at least I get a different error now.

I think it is a class file it has the file ext cs. I know this may seem so beginner but this is my first asp and I'm really new to it.
thanks for responding so quickly.
 
i know I copied/pasted right from this post to the project

string EmpLast = HttpContext.Current.Request.QueryString("employee_identifier");
string member_num = HttpContext.Current.Request.QueryString("member_number");

and that gives me this error

System.Web.HttpRequest.QueryString' is a 'property' but is used like a 'method'

 
nevermind I got it. It has to be brackets instead of parentheses around the value.

string EmpLast = HttpContext.Current.Request.QueryString["employee_identifier"];
string member_num = HttpContext.Current.Request.QueryString["member_number"];
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top