首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

判断多个网络路径是否为空的有关问题

2012-01-15 
判断多个网络路径是否为空的问题switch(IntType){case1:strFilePathsDoucmentPath+strRootDirectory+sSub

判断多个网络路径是否为空的问题
switch   (IntType)
                {
                        case   1:

                                strFilePath   =   sDoucmentPath   +   strRootDirectory   +   sSubDocumnet   +   strUserDirectory;

                                strFilePath   +=   sFileName;


                                if   (!System.IO.File.Exists(Server.MapPath(strFilePath)))
                                {
                                        strFilePath   =   "http:// "   +   this.Request.Url.Authority   +   sBackUpPath   +   strRootDirectory   +   sSubDocumnet   +   strUserDirectory;
                                        strFilePath   +=   sFileName;
                                }
                           
                                break;
                        case   0:

                                //以服务器中方式传入URL,
                                strFilePath   =   "http:// "   +   this.Request.Url.Authority   +   sDoucmentPath   +   strRootDirectory   +   strUserDirectory;
                                strFilePath   +=   sFileName;
                       
                                if   (!System.IO.File.Exists(strFilePath))
                                {
                                        strFilePath   =   "http:// "   +   this.Request.Url.Authority   +   sBackUpPath   +   strRootDirectory   +   strUserDirectory;
                                        strFilePath   +=   sFileName;
                                }
                     
                                break;


                        default:
                                break;
                }


说明:我要实现在线播放录音文件,我把网站发布在一个服务器上,数据库也在该服务器上,然而我的录音文件不仅在找个服务器上,其他的服务器上也有.现在的问题是我可以通过判断文件录音文件是否存在来启用被用的网络路径,发布网站的服务器呢现在可以实现找个功能,但是无法判断其他的存放录音文件的服务器路径的存在情况(总是显示无此链接,其实是有这个路径的)

[解决办法]
放在别的服务器上一般是没有权限造成的。
你可以在web.config里配置模拟,例子很多,搜索一下吧

热点排行