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

  • SEARCH
  • Home
  • 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 6911273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:55:52+00:00 2026-05-27T08:55:52+00:00

I got an error when trying to get the value of Int32.Parse(Request.QueryString[PLCID].ToString()) in the

  • 0

I got an error when trying to get the value of Int32.Parse(Request.QueryString["PLCID"].ToString()) in the thread method and i tried to use parameterizedthread but faild

here my code snippet

protected void btnReqConfirm_Click(object sender, EventArgs e)
{
    Int32 val = Int32.Parse(Request.QueryString["PLCID"].ToString());
    id = Guid.NewGuid();

    ThreadStart ts = new ThreadStart(longRunningProcess);
    Thread th = new Thread(ts);
    th.Start();

    Response.Redirect("Status.aspx?ID="+id.ToString());
}
protected void longRunningProcess()
{
    String _MachineName = String.Empty;
    _MachineIP = String.Empty;
    DBLayer.getMachineByPLCID(Int32.Parse(Request.QueryString["PLCID"].ToString()), out _MachineName, out _MachineIP);

    if (DBLayer.insertRequest(User.Identity.Name, DBLayer.getMachineID(_MachineName), Convert.ToDateTime(lblReqFromVal.Text), Convert.ToDateTime(lblReqToVal.Text)))
    {
        _PLCName = DBLayer._getPlCByID(Int32.Parse(Request.QueryString["PLCID"].ToString()));

        //stop mail now
        LogicLayer.AddNewListItem("Confirmation Mail", "You can initiate your session directly from this link : " + string.Format(@"http://IP/RRRProject/DirectSessionPage.aspx?Machine={0}", _MachineIP), (User.Identity.Name).Substring(5) + "@invensys.com");
        lblConfirmationMessage.Visible = true;
        lblConfirmationMessage.ForeColor = Color.Green;

        Thread.Sleep(9000);
        SimpleProcessCollections.Add(id, "Some result.");
    }
}

any idea??

  • 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-05-27T08:55:53+00:00Added an answer on May 27, 2026 at 8:55 am

    I suppose that the new Thread is not tied to the same HttpContext of the first one; a Request.QueryString call is a call to HttpContext.Current.Request.QueryString so ts won’t see the parameters of your webapplications.

    Anyway, you can pass the QueryString to the Thread and use it. Look at the code sample.

    protected void btnReqConfirm_Click(object sender, EventArgs e)
    {
     ...
       ThreadStart ts = new ThreadStart(longRunningProcess(Request.QueryString));
     ...
    }
    
    protected void longRunningProcess(NameValueCollection queryString)
    {
     ...
    
        _PLCName = DBLayer._getPlCByID(Int32.Parse(queryString["PLCID"].ToString()));
     ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this error when trying to update an image. It was a cross-thread
I am trying to get my sltag value but I got some errors in
I'm trying to get an MD5 hash of a value in ColdFusion. I tried
I got this error today when trying to open a Visual Studio 2008 project
I got an error today while trying to do some formatting to existing code.
I'm trying to shake a window, but got error mess in console. My code:
While working on an existing project I suddenly got the following error when trying
I was trying to install webrat on my Mac, but I've got the error,
While trying to generate classes from a xsd, i got this error: java.lang.IllegalArgumentException: Illegal
hi I am trying to get my arraylist value into my image adapter class

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.