在asp.net中运行视频时来源无效

尝试在asp.net中运行视频时,我无法运行

protected void Button1_Click(object sender,EventArgs e)
{
        string constr = Configurationmanager.ConnectionStrings["DbConnection"].ConnectionString;

        SqlConnection con = new SqlConnection(constr);

        FileUpload1.SaveAs(Server.MapPath("~/video/") + Path.GetFileName(FileUpload1.FileName));

        string link = "video/" + Path.GetFileName(FileUpload1.FileName);
        link = "<video Width = 400 Controls><source src=" + link + " type = video/mp4></video>";

        string query = "Insert into VideoTable (vi_Name,vi_Link) Values ('" + TextBox1.Text + "','" + link + "')";

        SqlCommand cmd = new SqlCommand(query,con);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();

        Label1.Text = "Video is saved successfully";
    }

<!-- This is web page to dispay -->[

<!-- begin snippet: js hide: false console: true babel: false -->

] [1]

 <form id="form1" runat="server">
        <div>
            <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" Text="DB E &amp; C Videos"></asp:Label>
            <br />
            <br />
            All uploaded video in Datalist<br />
            <br />
            <asp:DataList ID="DataList1" runat="server" BorderWidth="2px" DataKeyField="vi_Id" DataSourceID="SqlDataSource1" GridLines="Both" RepeatColumns="2" RepeatDirection="Horizontal" ShowFooter="False" ShowHeader="False" Width="305px">
                <ItemTemplate>
                    <table class="auto-style1">
                        <tr>
                            <td>
                                <asp:Label ID="Label2" runat="server" Font-Bold="True" Text='<%# Eval("vi_Name") %>'></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Literal ID="Literal1" runat="server" Text='<%# Eval("vi_Link") %>'></asp:Literal>
                            </td>
                        </tr>
                    </table>
                    <br />
                    <br />
                </ItemTemplate>
            </asp:DataList>
            <br />
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DbConnection %>" SelectCommand="SELECT * FROM [VideoTable]"></asp:SqlDataSource>
        </div>`
<?xml version="1.0" encoding="utf-8"?>

<!--
  For more information on how to configure your ASP.NET application,please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    <add name="DbConnection" connectionString="Data Source=.\SQLExpress;Initial Catalog=test;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.webServer>
    <directoryBrowse enabled="true" />
    <staticContent>
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    </staticContent>
  </system.webServer>
  <system.web>
    <compilation debug="true" targetFramework="4.7.2"/>
    <httpruntime targetFramework="4.7.2" executionTimeout="380" maxRequestLength="500000"/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider,microsoft.CodeDom.Providers.DotNetCompilerPlatform,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider,PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>


</configuration>
ddm983916 回答:在asp.net中运行视频时来源无效

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3073011.html

大家都在问