当用户未登录时,在Web应用程序中显示超链接到PDF,当用户IS登录时返回404

时间:2015-04-13 22:54:18

标签: asp.net-mvc asp.net-mvc-4 hyperlink

我有一个ASP.NET MVC 4 Web应用程序。在主页面上有一个打开PDF的超链接。当用户登录时,链接有效 - 显示PDF。当用户 登录时,点击该链接会返回404。

在某人的应用程序后面进行错误修复,所以我对代码并不熟悉。任何指针或指导都将非常感激。

有问题的链接是:

<ul>
    <li><a href="Files/link_to_pdf.pdf" target="_blank">Link to PDF</a></li>
</ul>

链接前的页面代码为:

<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" />

        <meta charset="utf-8" />
        <title>@ViewBag.Title</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </head>
    <body id="@ViewBag.TripId">
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">
                        <a href="@Url.Action("Index", "Survey")">
                            <img src="@Url.Content("~/Images/logo.png")" alt="The Logo" /><span>TEST COMPANY</span>
                        </a>
                    </p>
                </div>
                @Html.Partial("_LoginPartial")
            </div>
        </header>
        <div id="body">
            @if (ViewBag.TripId == null)
            {        
                <section class="sidebar" id="left">
                    <h3>Board Officers</h3>
                    <ul>
                        <li><a href="test_link_1" target="_blank">Tech Dept</a></li>
                        <li>Managers</li>
                        <li><a href="test_link_2" target="_blank">Business Dept</a></li>
                        <li>Executive Council</li>
                        <li><a href="test_link_3"
                        <li>Quality Assurance</li>
                        <li><a href="test_link_4" target="_blank">QA</a></li>
                        <li>Administration</li>
                        <li><a href="test_link_5" target="_blank">Admin</a></li>
                        <li>Shipping & Receiving</li>
                    </ul>
                    <h3>More Information</h3>
                    <ul>
                        <li><a href="Files/link_to_pdf.pdf" target="_blank">Link to PDF</a></li>
                    </ul>
                </section>

0 个答案:

没有答案