Ajax调用.cshtml:403 FORBIDDEN

时间:2016-01-23 16:15:28

标签: asp.net razor http-status-code-403

我有.cshtml文件的AJAX调用,它一直说它被禁止...这是错误我设法从Firebug中拔出...使用ASP.net应用程序,框架4 ......我不知道如何解决这个问题,我尝试了大部分在网上找到的东西

重置VS用户,安装Web平台......我不知道下一步该怎么做

以下是来自firebug的错误:

stop()

**编辑:**

这就是我调用.cshtml文件的方式

<!DOCTYPE html>
<html>
   <head>
       <title>This type of page is not served.</title>
       <meta name="viewport" content="width=device-width" />
       <style>
            body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
            p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
            b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
            H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
            H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
            pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
           .marker {font-weight: bold; color: black;text-decoration: none;}
           .version {color: gray;}
           .error {margin-bottom: 10px;}
           .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

     @media screen and (max-width: 639px) {
           pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
     }
     @media screen and (max-width: 479px) {
           pre { width: 280px; }
     }
    </style>
</head>

<body bgcolor="white">

        <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

        <h2> <i>This type of page is not served.</i> </h2></span>

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

        <b> Description: </b>The type of page you have requested is not served because it has been
   explicitly forbidden. &nbsp;The extension '.cshtml' may be incorrect. &nbsp;&nbsp;Please review the
   URL below and make sure that it is spelled correctly.
        <br><br>

        <b> Requested URL: </b>/PopunjavanjeUpitnika/PopunjavanjeUpitnika/Upitnik.cshtml<br><br>


        <hr width=100% size=1 color=silver>

        <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version
   :4.0.30319.34280

        </font>

</body>

1 个答案:

答案 0 :(得分:0)

基于cshtml扩展,我假设上下文是ASP.NET MVC项目。如果是这样,那么你应该调用控制器的动作,它返回cshtml视图而不是直接调用视图文件。这是ASP.NET MVC的基础知识,我建议你查看http://www.asp.net/mvc/overview以便对它感到满意。