- C# / .NET 在类中使用Server.MapPath
自我修炼的小石头
c#ui
直接在类中使用Server.MapPath会出现错误,这是由于类中不能直接使用System.Web.UI.Page的非静态函数造成的。解决方法有两种:方法一、使类继承System.Web.UI.Page类classCFoo:System.Web.UI.Page在使用方法一时请注意:C#中,派生类只能从一个类中继承。换句话说,如果该类已经继承了其他类,则不能再继承Page类,只能使用第二种方法。方法
- Asp.Net 在类中使用Server.MapPath(随手笔记)
无味无感
.NETFramework
C#在类中使用Server.MapPath直接在类中使用Server.MapPath会出现错误,这是由于类中不能直接使用System.Web.UI.Page的非静态函数造成的。解决方法有两种:解决方案:方案1:使类继承System.Web.UI.Page类classCFoo:System.Web.UI.Page在使用方法一时请注意:C#中,派生类只能从一个类中继承。换句话说,如果该类已经继承了其他
- DataSet 读取xml文件
Joson.e8love
datasetxmlobjectstringpathc
DataSetds=newDataSet();ds.ReadXml(Server.MapPath(NetShop.Config.DbConfigs.GetSitePath+"images/flashdata/flash.config"));DataRow[]drs=ds.Tables[0].Select("","[SortOrder]ASC");//返回的是个DataRow[]://DataRow
- loniczip
live for myself
java前端服务器
if(!Directory.Exists(Server.MapPath(webUploadFile))){Directory.CreateDirectory(Server.MapPath(webUploadFile));}//stringpath=Server.MapPath(webUploadFile+filename);//获取存储的目标地址using(varzip=newZipFile(En
- Spire.doc读取模板文档,并在书签处插入内容
阿发博客
Spire.doc.net.netcorec#Spire.doc.netword
在书签位置插入文字//加载模板文档Documentdocument=newDocument(Server.MapPath("~/File/评价结果.doc"));//创建书签导航器BookmarksNavigatorbn=newBookmarksNavigator(document);//添加一个section到文档SectionnewSec=document.AddSection();//目标内
- 上传的问题(FileUpload控件上传不支持给定路径的格式 问题解决 )
weixin_30399155
stringfilepath=Server.MapPath("~/upload"); HttpFileCollectionuploadFile=Request.Files; for(inti=0;i0) { Label1.Text=""; Label
- C#中如何调整图像大小
fangyuan621
MicrosoftVisualStudioC#c#
1.首先要获取你想要调整大小的图像:stringpath=Server.MapPath(“~/Images”);System.Drawing.Imageimg=System.Drawing.Image.FromFile(string.Concat(path,”/3904.jpg”));2.将图像转换为Bitmap:Bitmapb=newBitmap(img);3.创建一个调整图像大小的方法priv
- c# npoi创建数据有效性约束制定列和单元格分别设置
葩熊
数据库前端c#
publicActionResultExport(){varcodesstringtemplateFileName=Path.Combine(Server.MapPath("/ExcelTemplate"),"Auto.xlsx");varfileName=@"Auto.xlsx";ExportExcelXlsxHelperex=newExportExcelXlsxHelper();ex.Init
- C#中判断文件夹或文件是否存在的方法
BeanGo
WPFc#开发语言后端
一、根据虚拟路径获取文件物理路径:stringsavePath=Server.MapPath("~/Uploads/RemoteDatum/");二、判断文件夹是否存在if(!System.IO.Directory.Exists(@"E:\Files")){System.IO.Directory.CreateDirectory(@"E:\Files");//不存在就创建文件夹}三、判断文件是否存在
- ASP.NET 操作XML文件
HappySheep欢乐小羊
XML示例文件实例化(new)一个XML文档对象:XmlDocumentxml=newXmlDocument();载入实例化的XML对象:xml.Load(Server.MapPath("test.xml"));获取实例化的XML对象的节点:XmlNoderoot=xml.SelectSingleNode("root");获取节点的子节点列表:XmlNodeListrootlist=root.Ch
- EPPlus导出excel实例及设置工作簿比例
DunDunM
publicvoidPrintExcel(Listdatalist,Listzuzhilist,Listchuwailist){//创建excelstringfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".xlsx";stringnewpath=Server.MapPath("/excel/PrintExcel/")+filename;File
- ASP.NET MVC获取路径并下载的问题
CyborgNO1
最近在做一个ASP.NETMVC项目,有一个功能是实现生成excel文件并下载。在生成excel文件时,总是会因为路径问题,导致无法正确的写道文件位置。在网上查了给种方法,一直在说用Server.MapPath()。但是在我的项目中,是没有这个方法。对于我这种小白来说,当然是不知道原因了。最后在无意间发如何在ASP.NetCore中为Server.MapPath获取绝对路径的内同,于是就按照这种方
- C# 调用exe 传递参数
sqh001
System.Diagnostics.Processproc=newSystem.Diagnostics.Process();proc.StartInfo.FileName=Path.Combine(Server.MapPath("/"),"Office2Pdf.exe");proc.StartInfo.Arguments=string.Format("{0}{1}",officePath,p
- ASP.Net core 中Server.MapPath的替换方法
shanghaimoon
asp.netcorewebasp.net后端c#
最近忙着将原来的asp.net项目迁移到asp.netcore平台,整体还比较顺利,但其中也碰到不少问题,其中比比较值得关注的一个问题是,在netcore平台中,System.Web程序集已经取消了,要获取HttpContext并不是太容易,好在通过依赖注入,还是可以得到的,具体方法不在本文的讨论范围,大家可以自行百度。但是在得到了netcore版本的HttpContext后,发现已经不再有Ser
- error CS0103: 当前上下文中不存在名称“Server”; error CS0103: 当前上下文中不存在名称“Path”;error CS0103: 当前上下文中不存在名称“XXX”
认真看海
c#错误记录
Server.MapPath()的全名是System.Web.HttpContext.Current.Server.MapPath()。有时在程序调试时会提示“当前上下文中不存在名称“Server””错误,从而不支持函数Server.MapPath()的使用。尽管引用了命名空间“usingSystem.Web;”也是无济于事,此时就需要使用其全名,或者是当前使用Server.MapPath()函数
- c#将文件流转成pdf,并保存文件
qq_36276758
c#后台功能
最近比较忙,有一点时间,可以总结一下前几天遇到的问题,c#将从数据库中读取的base64流生成pdf,并保存文件byte[]fileData=(byte[])dt.Rows[0]["fileData"];stringfileName=DateTime.Now.ToString("yyyyMMddhhmmss")+".pdf";StringdirPath=Server.MapPath("/print
- asp.net web api2设置默认启动登录页面的方法
1.在Global.asax文件中添加Application_BeginRequest方法,如下如所示:publicclassWebApiApplication:HttpApplication{protectedvoidApplication_Start(){log4net.Config.XmlConfigurator.Configure(newFileInfo(Server.MapPath("~
- c# mysql 1062_C#中MySQL函数用DATASET 和 MySqlDataAdapter 操作数据库
weixin_39915267
c#mysql1062
[如果一门程序设计语言不支持数据库操作的话,其很难在现在的世界中存活下来。C#语言提供了丰富的数据库操作类库,极大地方便了对数据库的操作。在C#中,常用的有三种访问1.C#中调用MYSQL数据库时,我用的是MySQLDriverCS这个方法.一般的查询可以方便执[stringdbPath=@"Data\dbTest.mdb";stringdb=Server.MapPath(dbPath);stri
- ASP.NET MVC创建XML文件并实现元素增删改
如果创建如下的XML:darren创建XML文件在HomeController中,在根目录下创建new.xml文件:publicActionResultIndex(){returnView();}[HttpPost]publicActionResultAddXml(){stringpath=Server.MapPath("~/new.xml");XDocumentdoc=newXDocument(
- C#中调整图像大小的步骤详解
在本篇文章中,我将介绍如何在C#中来调整你想要的图像大小。要实现这一目标,我们可以采取以下几个步骤:1.首先要获取你想要调整大小的图像:stringpath=Server.MapPath("~/Images");System.Drawing.Imageimg=System.Drawing.Image.FromFile(string.Concat(path,"/3904.jpg"));2.将图像转换
- C# MVC 获取程序中 目录 或虚拟目录的实际文件目录路径
f5df0a516b61
System.Web.HttpContext.Current.Request.PhysicalApplicationPath;这个只能取得当前项目的根目录,也就是http://www.a.com/的根目录Server.MapPath("~/uploads");这个可以获取实际存在在项目中的uploads目录,也可以获取在IIS关联的虚拟目录
- asp.net简单读取xml文件信息
LMAOhuaNL
C#asp.Net
//以下是循环读取xml文件中节点的值 XmlDocumentxmlDoc=newXmlDocument(); xmlDoc.Load(Server.MapPath("Student1.xml"));//加载xml XmlNodeListNodeList=xmlDoc.SelectNodes(
- 最大在线人数统计
MRman0404
数据库
global.asax:protectedvoidSession_Start(Objectsender,EventArgse){Application.Lock();DataSetobjDataSet=newDataSet()objDataSet.ReadXml(Server.MapPath("database/count.xml"));if(Convert.ToInt32(objDataSet.
- C# 上传RAR文件 解压 获取解压后的文件名称
下一秒_待续
C#类库方法
此方法适用于C盘windows文件夹中有WinRAR.exe文件if(fileExt.ToUpper()==".RAR"){stringzpath=Server.MapPath("~/SendFileZIP/");//不存在文件夹时创建文件夹if(!Directory.Exists(zpath)){Directory.CreateDirectory(zpath);}//导入rar压缩文件时,清空S
- 上传Rar文件
PatyTime
C#
if(fileExt.ToUpper()==".RAR"){stringzpath=Server.MapPath("~/SendFileZIP/");//不存在文件夹时创建文件夹if(!Directory.Exists(zpath)){Directory.CreateDirectory(zpath);}//导入rar压缩文件时,清空SendFileZIP文件夹里面所有的文件DirectoryInf
- 关于Server.MapPath()的命名空间
newnazi
代码
下面是c#连接access数据库的一个示例,其中用到了access数据库,大家也可以看看哦.asp.net-C#连接Access数据库连接字符串:"Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+System.Web.HttpContext.Current.Server.MapPath("App_Data\tbk.mdb;PersistSecurityI
- access最快速的批量导入SQL的方法 使用SqlBulkCopy
emailqjc
.NET
access最快速的批量导入SQL的方法使用SqlBulkCopy2008-11-2223:51stringfilename=DateTime.Now.ToString("yyyyMMdd")+".mdb";stringtablename=DateTime.Now.ToString("yyyyMMdd");if(File.Exists(Server.MapPath("/tempmdb/"+file
- ASPNET Core 中获取应用程序物理路径
十年河东,十年河西,莫欺骚年穷
.netcore
如果要得到传统的ASP.Net应用程序中的相对路径或虚拟路径对应的服务器物理路径,只需要使用使用Server.MapPath()方法来取得Asp.Net根目录的物理路径,如下所示://ClassicASP.NETpublicclassHomeController:Controller{publicActionResultIndex(){stringphysicalWebRootPath=Serve
- asp连接数据库示例
xiang588
技术文章
asp连接Access数据库(OleDb)setconn=server.createobject("adodb.connection")dbPath="config/bloo.mdb"connStr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&Server.MapPath(DBpath)conn.openconnStrasp连接SQLServer数
- Webform(文件上传)
weixin_30454481
uic#
1.HTML编码:2.控件:FileUpload它是用来选择要上传的文件,还需要一个按钮来将选中的文件上传到服务器上stringpath="images/"+FileUpload1.FileName;FileUpload1.SaveAs(Server.MapPath(path));优化1:文件保留原有名称和后缀stringpath="images/"+FileUpload1.FileName;优化
- PHP,安卓,UI,java,linux视频教程合集
cocos2d-x小菜
javaUIlinuxPHPandroid
╔-----------------------------------╗┆
- zookeeper admin 笔记
braveCS
zookeeper
Required Software
1) JDK>=1.6
2)推荐使用ensemble的ZooKeeper(至少3台),并run on separate machines
3)在Yahoo!,zk配置在特定的RHEL boxes里,2个cpu,2G内存,80G硬盘
数据和日志目录
1)数据目录里的文件是zk节点的持久化备份,包括快照和事务日
- Spring配置多个连接池
easterfly
spring
项目中需要同时连接多个数据库的时候,如何才能在需要用到哪个数据库就连接哪个数据库呢?
Spring中有关于dataSource的配置:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
&nb
- Mysql
171815164
mysql
例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WI
TH GRANT OPTION;
如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作
- CommonDAO(公共/基础DAO)
g21121
DAO
好久没有更新博客了,最近一段时间工作比较忙,所以请见谅,无论你是爱看呢还是爱看呢还是爱看呢,总之或许对你有些帮助。
DAO(Data Access Object)是一个数据访问(顾名思义就是与数据库打交道)接口,DAO一般在业
- 直言有讳
永夜-极光
感悟随笔
1.转载地址:http://blog.csdn.net/jasonblog/article/details/10813313
精华:
“直言有讳”是阿里巴巴提倡的一种观念,而我在此之前并没有很深刻的认识。为什么呢?就好比是读书时候做阅读理解,我喜欢我自己的解读,并不喜欢老师给的意思。在这里也是。我自己坚持的原则是互相尊重,我觉得阿里巴巴很多价值观其实是基本的做人
- 安装CentOS 7 和Win 7后,Win7 引导丢失
随便小屋
centos
一般安装双系统的顺序是先装Win7,然后在安装CentOS,这样CentOS可以引导WIN 7启动。但安装CentOS7后,却找不到Win7 的引导,稍微修改一点东西即可。
一、首先具有root 的权限。
即进入Terminal后输入命令su,然后输入密码即可
二、利用vim编辑器打开/boot/grub2/grub.cfg文件进行修改
v
- Oracle备份与恢复案例
aijuans
oracle
Oracle备份与恢复案例
一. 理解什么是数据库恢复当我们使用一个数据库时,总希望数据库的内容是可靠的、正确的,但由于计算机系统的故障(硬件故障、软件故障、网络故障、进程故障和系统故障)影响数据库系统的操作,影响数据库中数据的正确性,甚至破坏数据库,使数据库中全部或部分数据丢失。因此当发生上述故障后,希望能重构这个完整的数据库,该处理称为数据库恢复。恢复过程大致可以分为复原(Restore)与
- JavaEE开源快速开发平台G4Studio v5.0发布
無為子
我非常高兴地宣布,今天我们最新的JavaEE开源快速开发平台G4Studio_V5.0版本已经正式发布。
访问G4Studio网站
http://www.g4it.org
2013-04-06 发布G4Studio_V5.0版本
功能新增
(1). 新增了调用Oracle存储过程返回游标,并将游标映射为Java List集合对象的标
- Oracle显示根据高考分数模拟录取
百合不是茶
PL/SQL编程oracle例子模拟高考录取学习交流
题目要求:
1,创建student表和result表
2,pl/sql对学生的成绩数据进行处理
3,处理的逻辑是根据每门专业课的最低分线和总分的最低分数线自动的将录取和落选
1,创建student表,和result表
学生信息表;
create table student(
student_id number primary key,--学生id
- 优秀的领导与差劲的领导
bijian1013
领导管理团队
责任
优秀的领导:优秀的领导总是对他所负责的项目担负起责任。如果项目不幸失败了,那么他知道该受责备的人是他自己,并且敢于承认错误。
差劲的领导:差劲的领导觉得这不是他的问题,因此他会想方设法证明是他的团队不行,或是将责任归咎于团队中他不喜欢的那几个成员身上。
努力工作
优秀的领导:团队领导应该是团队成员的榜样。至少,他应该与团队中的其他成员一样努力工作。这仅仅因为他
- js函数在浏览器下的兼容
Bill_chen
jquery浏览器IEDWRext
做前端开发的工程师,少不了要用FF进行测试,纯js函数在不同浏览器下,名称也可能不同。对于IE6和FF,取得下一结点的函数就不尽相同:
IE6:node.nextSibling,对于FF是不能识别的;
FF:node.nextElementSibling,对于IE是不能识别的;
兼容解决方式:var Div = node.nextSibl
- 【JVM四】老年代垃圾回收:吞吐量垃圾收集器(Throughput GC)
bit1129
垃圾回收
吞吐量与用户线程暂停时间
衡量垃圾回收算法优劣的指标有两个:
吞吐量越高,则算法越好
暂停时间越短,则算法越好
首先说明吞吐量和暂停时间的含义。
垃圾回收时,JVM会启动几个特定的GC线程来完成垃圾回收的任务,这些GC线程与应用的用户线程产生竞争关系,共同竞争处理器资源以及CPU的执行时间。GC线程不会对用户带来的任何价值,因此,好的GC应该占
- J2EE监听器和过滤器基础
白糖_
J2EE
Servlet程序由Servlet,Filter和Listener组成,其中监听器用来监听Servlet容器上下文。
监听器通常分三类:基于Servlet上下文的ServletContex监听,基于会话的HttpSession监听和基于请求的ServletRequest监听。
ServletContex监听器
ServletContex又叫application
- 博弈AngularJS讲义(16) - 提供者
boyitech
jsAngularJSapiAngularProvider
Angular框架提供了强大的依赖注入机制,这一切都是有注入器(injector)完成. 注入器会自动实例化服务组件和符合Angular API规则的特殊对象,例如控制器,指令,过滤器动画等。
那注入器怎么知道如何去创建这些特殊的对象呢? Angular提供了5种方式让注入器创建对象,其中最基础的方式就是提供者(provider), 其余四种方式(Value, Fac
- java-写一函数f(a,b),它带有两个字符串参数并返回一串字符,该字符串只包含在两个串中都有的并按照在a中的顺序。
bylijinnan
java
public class CommonSubSequence {
/**
* 题目:写一函数f(a,b),它带有两个字符串参数并返回一串字符,该字符串只包含在两个串中都有的并按照在a中的顺序。
* 写一个版本算法复杂度O(N^2)和一个O(N) 。
*
* O(N^2):对于a中的每个字符,遍历b中的每个字符,如果相同,则拷贝到新字符串中。
* O(
- sqlserver 2000 无法验证产品密钥
Chen.H
sqlwindowsSQL ServerMicrosoft
在 Service Pack 4 (SP 4), 是运行 Microsoft Windows Server 2003、 Microsoft Windows Storage Server 2003 或 Microsoft Windows 2000 服务器上您尝试安装 Microsoft SQL Server 2000 通过卷许可协议 (VLA) 媒体。 这样做, 收到以下错误信息CD KEY的 SQ
- [新概念武器]气象战争
comsci
气象战争的发动者必须是拥有发射深空航天器能力的国家或者组织....
原因如下:
地球上的气候变化和大气层中的云层涡旋场有密切的关系,而维持一个在大气层某个层次
- oracle 中 rollup、cube、grouping 使用详解
daizj
oraclegroupingrollupcube
oracle 中 rollup、cube、grouping 使用详解 -- 使用oracle 样例表演示 转自namesliu
-- 使用oracle 的样列库,演示 rollup, cube, grouping 的用法与使用场景
--- ROLLUP , 为了理解分组的成员数量,我增加了 分组的计数 COUNT(SAL)
- 技术资料汇总分享
Dead_knight
技术资料汇总 分享
本人汇总的技术资料,分享出来,希望对大家有用。
http://pan.baidu.com/s/1jGr56uE
资料主要包含:
Workflow->工作流相关理论、框架(OSWorkflow、JBPM、Activiti、fireflow...)
Security->java安全相关资料(SSL、SSO、SpringSecurity、Shiro、JAAS...)
Ser
- 初一下学期难记忆单词背诵第一课
dcj3sjt126com
englishword
could 能够
minute 分钟
Tuesday 星期二
February 二月
eighteenth 第十八
listen 听
careful 小心的,仔细的
short 短的
heavy 重的
empty 空的
certainly 当然
carry 携带;搬运
tape 磁带
basket 蓝子
bottle 瓶
juice 汁,果汁
head 头;头部
- 截取视图的图片, 然后分享出去
dcj3sjt126com
OSObjective-C
OS 7 has a new method that allows you to draw a view hierarchy into the current graphics context. This can be used to get an UIImage very fast.
I implemented a category method on UIView to get the vi
- MySql重置密码
fanxiaolong
MySql重置密码
方法一:
在my.ini的[mysqld]字段加入:
skip-grant-tables
重启mysql服务,这时的mysql不需要密码即可登录数据库
然后进入mysql
mysql>use mysql;
mysql>更新 user set password=password('新密码') WHERE User='root';
mysq
- Ehcache(03)——Ehcache中储存缓存的方式
234390216
ehcacheMemoryStoreDiskStore存储驱除策略
Ehcache中储存缓存的方式
目录
1 堆内存(MemoryStore)
1.1 指定可用内存
1.2 驱除策略
1.3 元素过期
2 &nbs
- spring mvc中的@propertysource
jackyrong
spring mvc
在spring mvc中,在配置文件中的东西,可以在java代码中通过注解进行读取了:
@PropertySource 在spring 3.1中开始引入
比如有配置文件
config.properties
mongodb.url=1.2.3.4
mongodb.db=hello
则代码中
@PropertySource(&
- 重学单例模式
lanqiu17
单例Singleton模式
最近在重新学习设计模式,感觉对模式理解更加深刻。觉得有必要记下来。
第一个学的就是单例模式,单例模式估计是最好理解的模式了。它的作用就是防止外部创建实例,保证只有一个实例。
单例模式的常用实现方式有两种,就人们熟知的饱汉式与饥汉式,具体就不多说了。这里说下其他的实现方式
静态内部类方式:
package test.pattern.singleton.statics;
publ
- .NET开源核心运行时,且行且珍惜
netcome
java.net开源
背景
2014年11月12日,ASP.NET之父、微软云计算与企业级产品工程部执行副总裁Scott Guthrie,在Connect全球开发者在线会议上宣布,微软将开源全部.NET核心运行时,并将.NET 扩展为可在 Linux 和 Mac OS 平台上运行。.NET核心运行时将基于MIT开源许可协议发布,其中将包括执行.NET代码所需的一切项目——CLR、JIT编译器、垃圾收集器(GC)和核心
- 使用oscahe缓存技术减少与数据库的频繁交互
Everyday都不同
Web高并发oscahe缓存
此前一直不知道缓存的具体实现,只知道是把数据存储在内存中,以便下次直接从内存中读取。对于缓存的使用也没有概念,觉得缓存技术是一个比较”神秘陌生“的领域。但最近要用到缓存技术,发现还是很有必要一探究竟的。
缓存技术使用背景:一般来说,对于web项目,如果我们要什么数据直接jdbc查库好了,但是在遇到高并发的情形下,不可能每一次都是去查数据库,因为这样在高并发的情形下显得不太合理——
- Spring+Mybatis 手动控制事务
toknowme
mybatis
@Override
public boolean testDelete(String jobCode) throws Exception {
boolean flag = false;
&nbs
- 菜鸟级的android程序员面试时候需要掌握的知识点
xp9802
android
熟悉Android开发架构和API调用
掌握APP适应不同型号手机屏幕开发技巧
熟悉Android下的数据存储
熟练Android Debug Bridge Tool
熟练Eclipse/ADT及相关工具
熟悉Android框架原理及Activity生命周期
熟练进行Android UI布局
熟练使用SQLite数据库;
熟悉Android下网络通信机制,S