Me n My Programming

If Only I Have TIme

Illegal characters in path

I tried to open a template files for my apps and all I got is an error saying “Illegal characters in path”. So I google my way and found out that you need to insert @ in front of your path. Simple eh? Look at the example:

Error:

FileStream fs;

string path = Application.StartupPath + “\\..\..\templates\template.xml”;
fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

Correction:

string path = Application.StartupPath + @“\\..\..\templates\template.xml”;

Further explanation you can read from here: http://forums.asp.net/p/1043313/1457497.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on June 26, 2008 by in C# and tagged .
%d bloggers like this: