Diskuze: WebMatrix Publish ASP
V předchozím kvízu, Test znalostí C# .NET online, jsme si ověřili nabyté zkušenosti z kurzu.


Tady je ten web: http://www.fastcomputer.cz/
Furt nevím co mám nahrát, jelikož v Release složce je web, ale bez
codebehindu atd..
A když nahraju co nahraju, furt to hází 404.
Tak jsem si všiml že vše funguje, kromě stránek Default.aspx a Products.aspx a nejspíše když nefunguje Products tak nebude fungovat i Product.aspx .
Zkoušel jsem ty stránky smazat a vytvořit znova, ale proste nejde ( na
localu vše jde jak má ).
Přiložím zdrojový kód těchto stránek, jestli by někdo nevěděl v čem
může být problém.
Default.aspx
<%@ Page Title="Uvod" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AppleDoff.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContentHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h1><%: Page.Title %></h1>
</asp:Content>
Products.aspx:
<%@ Page Title="Sortiment" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Products.aspx.cs" Inherits="AppleDoff.Page.Products" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContentHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:DataList ID="DataList1" runat="server" DataKeyField="Id" DataSourceID="ProductsDB" RepeatColumns="3" RepeatDirection="Horizontal">
<ItemTemplate>
<span class="product">
<center>
<br>
<img src="../Images/desing/<%# Eval("imgCislo") %>.png" width="213" height="139" alt="Produkt" />
<br>
<h2><%# Eval("nazev") %></h2>
<div class="popisproduktu">
<p><%# Eval("popis") %></p>
</div>
<div class="cena">
<asp:HyperLink CssClass="cenalink" ID="HyperLink1" runat="server" NavigateUrl='<%# "Product.aspx?id=" + Eval("Id") %>'>
<%# Eval("cenaDPH") %> kč<br>
Bez dph <%# Eval("cena") %> kč
</asp:HyperLink>
</div>
<br />
</center>
</span>
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="ProductsDB" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [Products] ORDER BY [Id] DESC"></asp:SqlDataSource>
</asp:Content>
Product.aspx:
<%@ Page Title="Produkt" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Product.aspx.cs" Inherits="AppleDoff.Page.Product" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContentHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:FormView ID="ProductFormView" runat="server" DataKeyNames="Id" DataSourceID="ProductsDB">
<EditItemTemplate>
Id:
<asp:Label ID="IdLabel1" runat="server" Text='<%# Eval("Id") %>' />
<br />
nazev:
<asp:TextBox ID="nazevTextBox" runat="server" Text='<%# Bind("nazev") %>' />
<br />
popis:
<asp:TextBox ID="popisTextBox" runat="server" Text='<%# Bind("popis") %>' />
<br />
cena:
<asp:TextBox ID="cenaTextBox" runat="server" Text='<%# Bind("cena") %>' />
<br />
cenaDPH:
<asp:TextBox ID="cenaDPHTextBox" runat="server" Text='<%# Bind("cenaDPH") %>' />
<br />
imgCislo:
<asp:TextBox ID="imgCisloTextBox" runat="server" Text='<%# Bind("imgCislo") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
nazev:
<asp:TextBox ID="nazevTextBox" runat="server" Text='<%# Bind("nazev") %>' />
<br />
popis:
<asp:TextBox ID="popisTextBox" runat="server" Text='<%# Bind("popis") %>' />
<br />
cena:
<asp:TextBox ID="cenaTextBox" runat="server" Text='<%# Bind("cena") %>' />
<br />
cenaDPH:
<asp:TextBox ID="cenaDPHTextBox" runat="server" Text='<%# Bind("cenaDPH") %>' />
<br />
imgCislo:
<asp:TextBox ID="imgCisloTextBox" runat="server" Text='<%# Bind("imgCislo") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Id:
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
<br />
nazev:
<asp:Label ID="nazevLabel" runat="server" Text='<%# Bind("nazev") %>' />
<br />
popis:
<asp:Label ID="popisLabel" runat="server" Text='<%# Bind("popis") %>' />
<br />
cena:
<asp:Label ID="cenaLabel" runat="server" Text='<%# Bind("cena") %>' />
<br />
cenaDPH:
<asp:Label ID="cenaDPHLabel" runat="server" Text='<%# Bind("cenaDPH") %>' />
<br />
imgCislo:
<asp:Label ID="imgCisloLabel" runat="server" Text='<%# Bind("imgCislo") %>' />
<br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" />
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New" />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="ProductsDB" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Products] WHERE [Id] = @Id" InsertCommand="INSERT INTO [Products] ([nazev], [popis], [cena], [cenaDPH], [imgCislo]) VALUES (@nazev, @popis, @cena, @cenaDPH, @imgCislo)" SelectCommand="SELECT * FROM [Products] WHERE ([Id] = @Id)" UpdateCommand="UPDATE [Products] SET [nazev] = @nazev, [popis] = @popis, [cena] = @cena, [cenaDPH] = @cenaDPH, [imgCislo] = @imgCislo WHERE [Id] = @Id">
<DeleteParameters>
<asp:Parameter Name="Id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="nazev" Type="String" />
<asp:Parameter Name="popis" Type="String" />
<asp:Parameter Name="cena" Type="String" />
<asp:Parameter Name="cenaDPH" Type="String" />
<asp:Parameter Name="imgCislo" Type="Int32" />
</InsertParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="Id" QueryStringField="id" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="nazev" Type="String" />
<asp:Parameter Name="popis" Type="String" />
<asp:Parameter Name="cena" Type="String" />
<asp:Parameter Name="cenaDPH" Type="String" />
<asp:Parameter Name="imgCislo" Type="Int32" />
<asp:Parameter Name="Id" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
Lako:21.2.2014 18:02
není tam náhodu problém ten, že tyhl 2 stránky šahají do databáze -
databáze to je daší kapitolka při publikování..
Jinak visual studio podporuje publikování přes ftp..
Ty 2 nejspíše ano, ale Default.aspx neděla nic jiného než vypíše to co má v Title. Takže do DB nešaha.
Pomoci VS jsem zkoušel publikovat, je vše ok, ale nenahraje tam CodeBehind, pokud se tam nemá nahrávat, nahrává dobře, ale nefunguje Default a ty 2 stránky. :/
Nevím co s tím furt je, teď mi to haže při publikaci:
2>Unable to add 'Site.Master' to the Web site. Access is denied (550).
2>Unable to add 'Site.Mobile.Master' to the Web site. Access is denied
(550).
2>Unable to add 'ViewSwitcher.ascx' to the Web site. Access is denied
(550).
Nakonec jsem našel způsob to publikovat přes System Files.
Napojil jsem se na DB a sortiment jíž funguje.
Ale nechápu proč nefunguje Default.aspx, je skoro prázdný. Kde jsem mohl
udělat chybu?
Zobrazeno 7 zpráv z 7.