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");//如果是管理员,则进入管理员登录界面}}