Click to See Complete Forum and Search --> : Unrecognized escape sequence


shash
August 12th, 2004, 12:20 PM
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

Acephalus
August 12th, 2004, 12:29 PM
Replace the linePage.Response.ContentType = "C:\Documents and Settings\sshinde\My Documents\Visual Studio Projects\RSSFeed\RSSFeed\test.rss";withPage.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 :)

shash
August 12th, 2004, 12:44 PM
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

Acephalus
August 12th, 2004, 01:11 PM
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.

shash
August 12th, 2004, 01:28 PM
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

Andy Tacker
August 13th, 2004, 01:45 AM
(@"<\$(?<xpath>.*?)\$>")

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

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

for example...

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);