Asp.net ASP等同于Ajax?
奇怪的问题。我需要使用一个包含ID的JavaScript数组,从数据库中获取额外的信息,使用ID作为行ID 然后我需要使用这些附加信息,并使用Ajax将其发送到另一个文件(aspx),该文件将使用这些信息旋转图像 除非我可以在同一个文件中使用ASP Classic和ASP.NET(C#)? -或者我可以使用大致相同的ASP代码访问我的数据库吗 旋转脚本Asp.net ASP等同于Ajax?,asp.net,database,asp-classic,Asp.net,Database,Asp Classic,奇怪的问题。我需要使用一个包含ID的JavaScript数组,从数据库中获取额外的信息,使用ID作为行ID 然后我需要使用这些附加信息,并使用Ajax将其发送到另一个文件(aspx),该文件将使用这些信息旋转图像 除非我可以在同一个文件中使用ASP Classic和ASP.NET(C#)? -或者我可以使用大致相同的ASP代码访问我的数据库吗 旋转脚本 <%@ Page Language="C#" Debug="true" %> <%@ Import Namespace="Sy
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Web" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
//string url = Request.QueryString["url"];
string url = @"C:\inetpub\wwwroot\testing\image.jpg";
string rotate_dir = Request.QueryString["dir"];
//create an image object from the image in that path
System.Drawing.Image img = System.Drawing.Image.FromFile(url);
//Rotate the image in memory
if (rotate_dir == "clockwise")
{
//Rotate clockwise
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
} else if (rotate_dir == "anticlockwise")
{
//Rotate anti-clockwise
img.RotateFlip(RotateFlipType.Rotate90FlipXY);
}
//Delete the file so the new image can be saved
System.IO.File.Delete(url);
//save the image to the file
img.Save(url);
//release image file
img.Dispose();
}
</script>
希望你明白我想做什么 您应该知道,您可以在asp classic中自由使用Javascript(从而使用ajax) 这意味着您可以轻松地执行以下操作:
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
conn.open Server.MapPath("foobar path") + ", Microsoft.ACE.OLEDB.12.0"
%><script type="text/javascript">
rotationArray = Array(id_Array.length);
for(int i = 0; i < id_Array.Length; i++
{
<% rs.open("SELECT rotation FROM images WHERE id="+ id_Array[i])%>
rotationArray[i] = <%= rs("rotation") %>;
<%rs.close() %>
}
//send rotationArray via ajax
set conn=Server.CreateObject(“ADODB.Connection”)
set rs=Server.CreateObject(“ADODB.Recordset”)
conn.open Server.MapPath(“foobar path”)+“,Microsoft.ACE.OLEDB.12.0”
%>
rotationArray=数组(id\u Array.length);
对于(int i=0;i
但总的来说,我建议您使用asp.NET数据库工具。
然后您只需将JS IDArray发送到aspx文件并在那里进行处理
作为参考,您可以检查您可以同时使用C#Net和ASP。这不是一个很好的方法。我的理解是您必须先创建C#项目,然后添加任何ASP页面。这将允许您从ASP应用程序中调用您的C#页面
我个人没有做过这些,但我确实看到过,所以我知道这在技术上是可能的。对不起,不,这对我来说没有意义。我看到你旋转图像,Asp Classic与此有什么关系?数据库是用来干什么的?@HanletEscaño我想他不明白Asp.NET还支持访问或访问的数据库连接更老的格式,并认为他必须使用asp classic进行数据获取:(我知道这是可能的……但这并不值得付出努力。在我们公司,我们在将Intranet迁移到c#
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
conn.open Server.MapPath("foobar path") + ", Microsoft.ACE.OLEDB.12.0"
%><script type="text/javascript">
rotationArray = Array(id_Array.length);
for(int i = 0; i < id_Array.Length; i++
{
<% rs.open("SELECT rotation FROM images WHERE id="+ id_Array[i])%>
rotationArray[i] = <%= rs("rotation") %>;
<%rs.close() %>
}
//send rotationArray via ajax