The name does not exist in the current context

mcrmg
mcrmg used Ask the Experts™
on
hi,

I installed VS2017 and am moving webpages from website into a new webapplication. I am getting


Error      CS0103      The name 'msg' does not exist in the current context      


any ideas?  thanks


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;




public partial class CremacLogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


        Session["level"] = null;
        Session["user"] = null;

        msg.Text = Request.QueryString["msg"];


    }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Miguel OzSenior Software Engineer
Top Expert 2009

Commented:
It seems that you are missing msg in your aspx file. Please check.
If more help needed, please add your aspx file.

Author

Commented:
thanks for the quick reply. There is msg in the aspx file.  thanks

 <center><asp:Label id="msg" runat="server" style="font-weight:bold"></asp:Label>

Open in new window

Senior Software Engineer
Top Expert 2009
Commented:
Check that you aspx url contains the msg as part of the query string. Your calling code may not be adding this query parameter to your URL.
Note: The label is not used as parameter in the page. If more help needed please post page URL.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial