CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Location
    USA
    Posts
    90

    Unrecognized escape sequence

    Hi Can anyone suggest why am I getting ERROR (nrecognized escape sequence)
    I am showing code where am I getting the error..

    public static void Main()
    {
    Page.Response.ContentType = "C:\Documents and Settings\sshinde\My Documents\Visual Studio Projects\RSSFeed\RSSFeed\test.rss";

    RSSFeedGenerator gen = new RSSFeedGenerator(Page.Response.Output);
    gen.WriteStartDocument();
    gen.WriteStartChannel("Developer Fusion RSS Feed","http://www.developerfusion.com/","Summary of the latest Articles Published on Developer Fusion","Copyright @ Developer Fusion","Shashi shinde");
    gen.WriteItem("Using ADO.NET with SQL Server","http://www.developerfusion.com/show/4278/","An Extensive examination of using ADO.NET to access SQL Server databases, from establishing","Shashi shinde", DateTime.Now,".NET");

    gen.WriteEndChannel();
    gen.WriteEndDocument();
    gen.Close();
    }



    Response would be appreciated.
    Thanks a ton
    Shash

  2. #2
    Join Date
    Jul 2003
    Posts
    101
    Replace the line
    Code:
    Page.Response.ContentType = "C:\Documents and Settings\sshinde\My Documents\Visual Studio Projects\RSSFeed\RSSFeed\test.rss";
    with
    Code:
    Page.Response.ContentType = @"C:\Documents and Settings\sshinde\My Documents\Visual Studio Projects\RSSFeed\RSSFeed\test.rss";
    Remember that backslash in a string implies an escape sequence
    Reality is the illusion created by lack of alcohol

  3. #3
    Join Date
    Aug 2004
    Location
    USA
    Posts
    90
    You were right but now it shows following error.....

    The type or namespace name 'Page' could not be found(are yo missing a using directive or an assembly refgerence?)


    and the error is highlighted at following location

    Page.Response.ContentType = @"C:\Documents and Settings\sshinde\My Documents\Visual Studio Projects\RSSFeed\RSSFeed\test.rss";

    Can Anyone Give me their suggestions?
    Appreciated..
    Thanks a ton
    Shash

  4. #4
    Join Date
    Jul 2003
    Posts
    101
    Yes... as the error says, you are missing an assembly reference. The compiler doesn't know where this class or namespace Page is located, so you have to specify that yourself.
    Reality is the illusion created by lack of alcohol

  5. #5
    Join Date
    Aug 2004
    Location
    USA
    Posts
    90
    Regex cmdXpaths = new Regex(@"<\$(?<xpath>.*?)\$>");


    What does above line mean?
    I know Regex stands for regular Expression but not clear about rest of the part...
    any suggestions?
    thanks a ton
    shash

  6. #6
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    (@"<\$(?<xpath>.*?)\$>")

    implies... there is a string like...
    mynewcode.test

    here, when you perform match, you can retrieve the value using variable "xpath".

    for example...
    Code:
    Regex m_regex = new Regex(@"<\$(?<xpath>.*?)\$>")
        String s = @"mynewcode.test";
        Match m = m_regex .Match(s);
        if ( m.Success )
            System.Console.WriteLine("User: " + m.Groups["xpath"].Value);
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured