Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Newbie Question

$
0
0

Can anyone please explain why I cannot declare the two variable hardwareID and docPath in the code below? I'm still learning .

public partial class Controls_WebUserControl : System.Web.UI.UserControl
{
    string hardwareID = Request.QueryString["HardwareID"];
    string docPath = "~/Documents/Hardware/" + hardwareID + "/";

    protected void Page_Load(object sender, EventArgs e)
    {

        if (hardwareID == null) {
            UploadStatusLabel.Text = "You did not specify a HardwareID. Please contact the Administrator.<br />";
        }
        else
        {

            //Create directory if it doesnt already exist
            if (!Directory.Exists(docPath))
            {
                Directory.CreateDirectory(Server.MapPath(docPath));
            }

        }
    }
}


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>