转义字符 转义字符的意义 
c# 转义字符 及@
\n   回车换行 
c# 转义字符 及@
\t     横向跳到下一制表位置 
c# 转义字符 及@
\v     竖向跳格 
c# 转义字符 及@
\b    退格 
c# 转义字符 及@
\r     回车 
c# 转义字符 及@
\f   走纸换页 
c# 转义字符 及@
\\     反斜线符"\" 
c# 转义字符 及@
\'     单引号符 
c# 转义字符 及@
\a    鸣铃 
c# 转义字符 及@
\ddd  1~3位八进制数所代表的字符 
c# 转义字符 及@
\xhh 1~2位十六进制数所代表的字符 

c# 转义字符 及@@在c#中为强制不转义 的符号,在里面的转义字符无效
c# 转义字符 及@
string str1 = "abc\n"// 这里\n当然默认转为换行符
c# 转义字符 及@
string str2 = @"abc\n" // 这里\n不自动转为换行符号,相当于 str2 = "abc\\n"
c# 转义字符 及@

c# 转义字符 及@以下两种方式等效
c# 转义字符 及@
string aaa="D:\\Root\\SendEmail\\SendEmail\\bin\\Debug\\downjmail.dll";
  
string aaa=@"D:\Root\SendEmail\SendEmail\bin\Debug\downjmail.dll
"; 

 通过使用后一种方法得到的字符串还可以横跨多行而不需要使用’\n’。使用这种方法唯一需要使用到转义序列的字符串是,其转义字符为””(两个连在一起的双引号)例如想将the word "big" contains three letters.赋值给’text’,我们就可以使用如下的语句:string text = @"the word ""big"" contains three letters."

补:textBox中换行必须是"\r\n",其他的"\r" 或 "\n" 或 "\n\r" 都会显示成小方框,其他控件未试。

Server.MapPath的用法     

 ./当前目录
/根目录
../上层目录(相对当前来说)

如果当前的网站目录为D:\wwwroot    浏览的页面路径为D:\wwwroot\company\news\show.asp
在show.asp页面中使用
Server.MapPath("./")   返回路径为:D:\wwwroot\company\news
Server.MapPath("/")    返回路径为:D:\wwwroot
Server.MapPath("../")   返回路径为:D:\wwwroot\company
server.MapPath(request.ServerVariables("Path_Info")) 
Request.ServerVariables("Path_Translated")  
上面两种方式返回路径为 D:\wwwroot\company\news\show.asp

相关文章:

  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2021-06-15
  • 2022-01-24
相关资源
相似解决方案