如何从html页面调用asp页面

时间:2010-03-23 06:15:34

标签: asp.net html

我在上传html&的网页时遇到了问题ASP。

实际上我有一个html页面名称作为index.html&另一个是asp页面名称为ContactUsNew.aspx。 html页面中有一个“联系我们”页面的链接。 &安培;对于这个链接,我使用代码。

<td style="height: 42px">
    <p class="menu01"><a href="ContactUsNew.aspx">CONTACT US</a></p>
</td>

当我在localhost中运行此应用程序时,它运行成功,但是当我在ftp上传这些页面的时候,在index.html页面上指定用于联系我们链接的路径不会切换到contactusnew.aspx页面。发生了路径错误 我创建了以下页面:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ContactUsNew.aspx.vb" Inherits="clients_excel_ContactUsNew" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Excel Informatics Pvt. Ltd. :: Careers</title>
    <link rel="stylesheet" type="text/css" href="images/style.css" />
    </head>
<body >
    <form id="form1" runat="server">
      <table width="759" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
            <td width="256">
                <img src="images/main01.jpg" width="256" height="41"></td>
            <td background="images/fon01.gif">
                <table width="503" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="270">
                            <a href="index.html">
                                <img src="images/but_home.gif" width="74" height="41" border="0"></a><img src="images/separator.gif"
                                    width="2" height="41"><a href="ContactUs.aspx"><img src="images/but_contacts.gif"
                                        width="96" height="41" border="0"></a><img src="images/separator.gif" width="2" height="41"></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td height="157">
                <img src="images/main_logo.gif" width="256" height="157"></td>
            <td width="503">
                <img src="images/main03.gif" width="503" height="157"></td>
        </tr>
    </table>
    <table border="0" cellpadding="0" cellspacing="0" width="759" align="center" background="images/fon_menu.gif">
        <tr>
            <td>
                <img src="images/menu01.gif" width="3" height="42" alt="" border="0"></td>
            <td>
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            <p class="menu01">
                                <a href="index.html">HOME</a></p>
                        </td>
                        <td>
                            <img src="images/e_menu.gif" alt="" width="24" height="42" border="0" /></td>
                        <td>
                            <p class="menu01">
                                <a href="Company.html">COMPANY</a></p>
                        </td>
                        <td>
                            <img src="images/e_menu.gif" alt="" width="24" height="42" border="0" /></td>
                        <td>
                            <p class="menu01">
                                <a href="Services.html">SERVICES</a></p>
                        </td>
                        <td>
                            <img src="images/e_menu.gif" alt="" width="24" height="42" border="0" /></td>
                        <td>
                            <p class="menu01">
                                <a href="Customer.html">CUSTOMERS</a></p>
                        </td>
                        <td>
                            <img src="images/e_menu.gif" alt="" width="24" height="42" border="0" /></td>
                        <td>
                            <p class="menu01">
                                <a href="Careers.html">CAREERS</a></p>
                        </td>
                        <td>
                            <img src="images/e_menu.gif" alt="" width="24" height="42" border="0" /></td>
                        <td>
                            <p class="menu01">
                                <a href="ContactUs.aspx">CONTACT US</a></p>
                        </td>
                    </tr>
                </table>
            </td>
            <td align="right">
                <img src="images/menu02.gif" width="3" height="42" alt="" border="0"></td>
        </tr>
    </table>
    <div align="center">
        <img src="images/main01.gif" width="759" height="5" alt="" border="0"></div>
    <table border="0" cellpadding="0" cellspacing="0" width="759" align="center">
        <tr valign="top">
            <td background="images/fon_left.gif">
                <img src="images/fon_left.gif" width="3" height="13" alt="" border="0"></td>
            <td width="753" bgcolor="#FFFFFF">
                <p class="px5">
                    <table border="0" cellpadding="12" cellspacing="0" width="100%">
                        <tr valign="top">
                            <td>
                                <!-- right -->
                                <table border="0" cellpadding="0" cellspacing="0" style="height: 375px">
                                    <tr>
                                        <td colspan="3" height="25" bgcolor="#777777">
                                            <p class="title">
                                                <img src="images/e01.gif" width="8" height="8" alt="" border="0">&nbsp;&nbsp; Contact
                                                Us</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3" bgcolor="#CCCCCC">
                                            <img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
                                    </tr>
                                    <tr>
                                        <td rowspan="3" bgcolor="#CCCCCC">
                                            <img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
                                        <td bgcolor="#EF9400" height="3">
                                            <img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
                                        <td rowspan="3" bgcolor="#CCCCCC">
                                            <img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
                                    </tr>
                                    <tr>
                                        <td width="725">
                                            <table width="100%">
                                                <tr>
                                                    <td>
                                                        <p>
                                                            Let us show you how we can help you with your IT requirements.</p>
                                                        <p>
                                                            <b>Excel Informatics Pvt. Ltd.</b><br />
                                                            C-2, Suryodaya Complex, Bldg. F.,<br />
                                                            Survey No. 154/4, Kalbhor Nagar,<br />
                                                            Chinchwad, Pune - 411019<br />
                                                            Maharashtra, INDIA<br />
                                                            Phone: 91+20+27476633, 27454132
                                                        </p>
                                                        <p>
                                                            <b>E-mail:</b> <a href="mailto:info@eiplonline.com" style="color: Blue">info@eiplonline.com</a><br />
                                                            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; or <a href="mailto:excelcom@vsnl.com"
                                                                style="color: Blue">excelcom@vsnl.com</a></p>
                                                        <div style="height: 120px;">
                                                            &nbsp;</div>
                                                    </td>
                                                    <td>
                                                        <table class="txt" cellpadding="2" width="350" cellspacing="0">
                                                            <%  If CType(Context.Items("success"), Boolean) = True Then%>
                                                            <tr>
                                                                <td height="30" colspan="3">
                                                                    <b>
                                                                        <asp:label id="LblSq" runat="server" text="Thank you for taking the time to give us your enquiry."
                                                                            cssclass="txtgrn" font-size="9pt"></asp:label>
                                                                    </b>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td height="10" style="width: 348px">
                                                                </td>
                                                            </tr>
                                                            <% Else%>
                                                            <tr>
                                                                <td colspan="2" class="help">
                                                                    &nbsp;&nbsp; &nbsp;&nbsp; All fields marked with * are mandatory.</td>
                                                            </tr>
                                                            <tr>
                                                                <td align="center" style="width: 348px">
                                                                    <table cellpadding="4" cellspacing="0">
                                                                        <tr>
                                                                            <td align="left" width="120">
                                                                                <span class="txterr">*</span> Your Name</td>
                                                                            <td width="230" align="left">
                                                                                <asp:textbox id="TxtName" runat="server" cssclass="txtbox" maxlength="100"></asp:textbox>
                                                                                <asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" controltovalidate="TxtName"
                                                                                    display="Dynamic" errormessage="Name is Required."></asp:requiredfieldvalidator>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                &nbsp;&nbsp; Address</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtAddress" runat="server" cssclass="txtbox" columns="25" maxlength="150"
                                                                                    rows="3" textmode="MultiLine"></asp:textbox>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                &nbsp;&nbsp; City</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtCity" runat="server" cssclass="txtbox" maxlength="25"></asp:textbox>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                &nbsp; &nbsp;State</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtState" runat="server" cssclass="txtbox" maxlength="25"></asp:textbox>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                &nbsp;&nbsp; Phone No.</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtPhno" runat="server" cssclass="txtbox" maxlength="15"></asp:textbox>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                <span class="txterr">*</span> Email ID</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtEmail" runat="server" cssclass="txtbox" maxlength="100"></asp:textbox>
                                                                                <asp:label id="LblEmail" runat="server" cssclass="txterr"></asp:label>
                                                                                <asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" controltovalidate="TxtEmail"
                                                                                    display="Dynamic" errormessage="Email is Required."></asp:requiredfieldvalidator>
                                                                                <asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server" controltovalidate="TxtEmail"
                                                                                    display="Dynamic" errormessage="Enter valid email address." validationexpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:regularexpressionvalidator>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                &nbsp;&nbsp; Subject</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtSubject" runat="server" cssclass="txtbox" maxlength="100"></asp:textbox>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td align="left">
                                                                                <span class="txterr">*</span> Your Message</td>
                                                                            <td align="left">
                                                                                <asp:textbox id="TxtMsg" runat="server" columns="25" rows="3" textmode="MultiLine"
                                                                                    cssclass="txtbox" maxlength="200"></asp:textbox>
                                                                                <asp:requiredfieldvalidator id="RequiredFieldValidator3" runat="server" controltovalidate="TxtMsg"
                                                                                    display="Dynamic" errormessage="Message is Required."></asp:requiredfieldvalidator>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                            </td>
                                                                            <td align="left">
                                                                                <asp:button id="BtnSubmit" runat="server" cssclass="txtbox" text="Submit" height="22px"
                                                                                    width="60px" />
                                                                                &nbsp;
                                                                                <asp:button id="BtnReset" runat="server" cssclass="txtbox" text="Reset" causesvalidation="False"
                                                                                    height="22px" width="60px" />
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                            <% End If%>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td background="images/t_fon.gif" height="28">
                                            <img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
                                    </tr>
                                    <tr>
                                        <td colspan="3" align="right">
                                            <img src="images/t_bot.gif" width="229" height="9" alt="" border="0"></td>
                                    </tr>
                                </table>
                                <!-- /right -->
                            </td>
                        </tr>
                    </table>
                    <br>
            </td>
            <td background="images/fon_right.gif">
                <img src="images/fon_right.gif" width="3" height="10" alt="" border="0"></td>
        </tr>
    </table>
    <table border="0" cellpadding="0" cellspacing="0" width="759" align="center">
        <tr>
            <td colspan="2" background="images/fon_bot.gif" height="42" align="right">
                <table border="0" cellpadding="0" cellspacing="0" width="510" background="">
                    <tr>
                        <td>
                            <p class="menu02">
                                <a href="index.html">Home</a></p>
                        </td>
                        <td>
                            <p class="menu02">
                                <a href="Company.html">Company</a></p>
                        </td>
                        <td>
                            <p class="menu02">
                                <a href="Services.html">Services</a></p>
                        </td>
                        <td>
                            <p class="menu02">
                                <a href="Customer.html">Customers</a></p>
                        </td>
                        <td>
                            <p class="menu02">
                                <a href="Careers.html">Careers</a></p>
                        </td>
                        <td>
                            <p class="menu02">
                                <a href="ContactUs.aspx">Contact Us</a></p>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr align="center">
            <td width="270" height="65">
                <img src="images/logo_bot.gif" alt="" border="0"></td>
            <td width="490">
                <p align="center" style="color: #FFFFFF;">
                    Copyright &copy; 2009 Excel Informatics Pvt. Ltd. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                    &nbsp; Designed & developed by <a style="color: #FFFFFF;" href="http://www.itiersolutions.com"
                        target="iTier">iTier solutions</a></p>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

请检查contactusnew.aspx文件是否也已上传,以及您的网络服务器是否支持ASP.NET。

答案 1 :(得分:0)

@Amol:这个答案可能与您的问题相符。 这来自http://forums.asp.net/t/1148374.aspx

操作的指令:

During development on my computer my project worked fine. When I copied it to the web server it failed with and error "Context is not a member of." I could not find the solution to the problem anywhere. By trial and error I found a solution that worked. I did the following for mypage.aspx with code behind mypage.aspx.vb.

◦I backed up the project.
◦The solution explorer contained a file mypage.aspx.designer.vb. I deleted it. Why? I noticed that when I created a new web form on the web server the designer.vb file was not included.
◦I changed the page directive so that it read CodeFile = "~/MyFolder/MyPage.aspx.vb". The full path within the root directory needs to be in the quotes.
◦I made sure the directive Inherits ="MyPage". This should be exactly the same name as the partial class in MyPage.aspx.vb.
◦I built the page.
◦After I corrected a few pages and ensured that they worked I used "Edit - Replace in files" menu command to change my code and I deleted all the .aspx.designer.vb files.