A. visual studio 用C#開發WEB應用程序
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>可以拖動的文本</title>
<style>
.drag{position:relative;cursor:hand}
</style>
<script language="JavaScript">
var dragapproved=false
var z,x,y
function move(){
if (event.button==1&&dragapproved){
z.style.pixelLeft=temp1+event.clientX-x
z.style.pixelTop=temp2+event.clientY-y
return false}}
function drags(){
if (!document.all)
return
if (event.srcElement.className=="drag"){
dragapproved=true
z=event.srcElement
temp1=z.style.pixelLeft
temp2=z.style.pixelTop
x=event.clientX
y=event.clientY
document.onmousemove=move}}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
</script>
</head>
<body>
<font class="drag">歡迎光臨微笑在線_網頁特效</font>
</body>
</html>
B. 我使用Visual Studio 2010開發Web應用程序,但是我安裝的Visual Studio 2010里只有C#模板,缺沒有Web模板
應該是你的vs2010源程序有問題,一般情況下正常的vs安裝完後,應該有web模板的,建議重新安裝vs2010
C. 怎麼用visual studio做web
看你會什麼語言,visual studio可以寫網頁的有vb.net和c#.
啟動vs然後單擊創建網站,然後選擇使用的語言vb.net或C#確定,然後就可以寫網頁了。
它們創建都是asp.net
D. visual studio 2008可以開發web api嗎
usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Data.SqlClient;publicpartialclassLogin:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){}protectedboolcheckText()//檢驗用戶名輸入字元,防止SQL注入{char[]a=txtNum.Text.ToCharArray();for(inti=0;ialert('驗證碼錯誤');location='Login.aspx'");//如果驗證碼錯誤,則將頁面定位到登錄界面}else{if(this.checkText()){if(this.ddlstatus.SelectedValue=="學生")//如果是學生登錄,則調用BaseClass中的CheckStudent方法進行檢驗{//將用戶輸入的密碼加密後與資料庫中的值進行比較stringuser=txtNum.Text.Trim();stringpwd=BaseClass.md5(txtPwd.Text.Trim());if(BaseClass.CheckStudent(user,pwd))//如果通過驗證,從資料庫中查詢出相關記錄值保存,並將頁面跳轉到學生主界面{SqlConnectionconn=BaseClass.DBCon();conn.Open();SqlCommandcmd=newSqlCommand("select*fromStudentwhereStudentNum='"+txtNum.Text.Trim()+"'",conn);SqlDataReaderread=cmd.ExecuteReader();read.Read();//讀取相關值顯示考生姓名和性別stringstuName=read["StudentName"].ToString();conn.Close();//存儲考生姓名和性別Session["name"]=stuName;Session["ID"]=txtNum.Text.Trim();//Response.Write("");Response.Redirect("student/StudentChose.aspx");}else//如果沒有通過驗證,彈出提示後定位到登錄界面{Response.Write("");}}if(this.ddlstatus.SelectedValue=="教師")//如果是教師登錄,則調用BaseClass中的CheckTeacher方法進行檢驗{//將用戶輸入的密碼加密後與資料庫中的值進行比較stringuser=txtNum.Text.Trim();stringpwd=BaseClass.md5(txtPwd.Text.Trim());if(BaseClass.CheckTeacher(user,pwd))//如果通過驗證,保存相關記錄值後將頁面跳轉到教師管理主界面{Session["Teacher"]=txtNum.Text;Response.Redirect("Teacher/TeacherManage.aspx");}else//如果沒有通過驗證,彈出提示後定位到登錄界面{Response.Write("");}}}}}catch(Exceptionex){MessageBox.Show("不好意思,系統出錯了,原因可能是:"+ex.Message);}}protectedvoidimgExit_Click(objectsender,ImageClickEventArgse){Response.Write("");}protectedvoidlkbtnAdminLogin_Click(objectsender,EventArgse){Response.Redirect("Admin/AdminLogin.aspx");//如果是管理員,則進入管理員登錄界面}}