文件上传代码(asp.net)
Boolean fileOK = false;
String path = "D:\\";
//string path = "1.gif";
String fileExtension =
System.IO.Path.GetExtension(Myfile.Value).ToLower();
string str1=System.IO.Path.GetFileName(Myfile.Value);
String[] allowedExtensions =
{ ".gif", ".png", ".jpeg", ".jpg" };
string temp = System.IO.Path.GetTempPath();
string temp1 = Server.MapPath("./");
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
}
}
if (fileOK)
{
try
&nbs
相关文档:
protected void Unite(GridView gv)
{
int i;
string LastType1;
int LastCell;
if (gv.Rows.Count > ......
主要类:
System.Web.HttpRuntime
System.Web.HttpApplicationFactory
System.Web.HttpApplication
System.Web.Compilation.BuildManager
System.Web.Compilation.ApplicationBuildProvider
System.Web.Compilation.BuildProvidersCompiler
System.Web.UI.PageHandlerFactory
请求处理 ......
首页:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......
在web config中 作如下配置:
<connectionStrings>
<add name="ydycon" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=|DataDirectory|ydy.mdb" providerName="System.Data.OleDb"/>
</connectionStrings>
在.net文件中应用链接 ......