CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • CS0103: The name 'getName' does not exist in the current context.

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    6253
  • Date Created
    Thursday, June 16, 2022
  • Last Updated
    Friday, June 17, 2022
  • This Article Has been Viewed
    402 times
  • Short Desc
    The name does not exist in the current context and will happen if one of the following is true in both C# and VB.NET.
  • Details
    The code below uses getName(v), but it is not properly formatted.

    (Ignore the open and closing brackets in these examples)
    <%
    Response.Write(getFile + "(" + getName(v) + ") Uploaded Successfully!<br />");
    %>
  • Recreate Issue
    The code below uses getName(v), but it is not properly formatted.
    <%

    'C#'
    Response.Write(getFile + "(" + getName[v] + ") Uploaded Successfully!<br />");
    'VB
    Response.Write(getFile & "(" & getName(v) & ") Uploaded Successfully!<br />");

    %>
  • Resolve Issue
    We need to look at the source for the getName(v) variable and make certain it is spelled properly.
    The originating code is
    <%

    'C#'
    string GetName = Request.Form["ImageTitle"];
    OR
    'VB
    Dim getName As String = Request.Form("ImageTitle")
    %>

    Looking at both examples we see that our name starts with a capital G and not a lowercase g.
    <%

    'C#'
    Response.Write(getFile + "(" + GetName[v] + ") Uploaded Successfully!<br />");
    'VB
    Response.Write(getFile & "(" & GetName(v) & ") Uploaded Successfully!<br />");

    %>