我在Microsoft Visual Studio Express 2013 for Web中创建了一个新项目.它是一个ASP.NET MVC 5 - .NET Framework 4.5项目.
我想处理(无法找到资源):

我确实使用下面的代码处理它.
如果我执行类似(/ Home/kddiede/ddiij)或(/ djdied/djie/djs)的操作,此代码将起作用,这将导致显示我的自定义错误页面.
但是,当我尝试执行类似(/ Home/kddiede/ddiij/dfd/sdfds/dsf/dsfds/fd)或任何长的不存在的URL时,它会向我显示:

代码来自:http://www.codeproject.com/Articles/635324/Another-set-of-ASP-NET-MVC-4-tips
技巧16:自定义错误屏幕
错误页面位于/View/Shared/Error.cshtml中
Web.config文件
<system.web>
<customErrors mode="RemoteOnly" />
</system.web>
Run Code Online (Sandbox Code Playgroud)
Global.asax中
protected void Application_EndRequest(Object sender, EventArgs e)
{
ErrorConfig.Handle(Context);
}
Run Code Online (Sandbox Code Playgroud)
ErrorConfig类
public class ErrorConfig
{
public static void Handle(HttpContext context)
{
switch (context.Response.StatusCode)
{
//Not authorized
case 401:
Show(context, 401);
break;
//Not found
case 404:
Show(context, 404);
break;
}
}
static void Show(HttpContext context, Int32 code)
{
context.Response.Clear(); …Run Code Online (Sandbox Code Playgroud) 我和我的朋友有一个网站(http://www.ferfereh.ir - 抱歉不是英文)一年.我们一直在使用安装了wordpress的Linux Apache主机.现在,我们所有的帖子(有永久链接结构= /%category%/%postname%.html)突然爆发并说:
nginx的
也许我们的主机提供商安装了NginX.我不知道Nginx到底是什么,但我在某处读到它与.htaccess配置有一些冲突,这使得我们永久链接,是的.
我该怎么办?
非常感谢
我正在使用下面的jQuery调用来加载位于同一服务器上的.php文件.
但是,使用Chrome的javascript控制台,它在我试图加载的php文件上报告"404 not found".虽然,我可以直接加载文件,只需在控制台中单击该文件即可.
此外,我可以直接从它报告404(未找到)的javascript控制台复制文件的URL,打开一个新选项卡,将其粘贴到地址栏中,然后点击脚本,没有问题.
这是jQuery get方法特有的吗?什么可能导致get方法中的页面404,但直接调用时执行正常?
$('.colorReset').click
(
function()
{
var myImage = $('#theme :selected').text();
$.get('<?php echo get_bloginfo('template_directory') ?>/colorReset.php', {theme: myImage, spot: '1'}, function(data){doColor('#theme_header_color', data);});
}
);
//script never gets to the doColor function, due to the apparent 404 on colorReset.php
function doColor(el, color)
{
$(el).val(color).trigger('keyup');
$(el).attr('value', color);
$(el).val(color);
}
Run Code Online (Sandbox Code Playgroud)



这是源文件colorReset.php,由get ...调用.
<?php
require_once('../../../wp-blog-header.php');
add_action( 'admin_init', 'check_user' );
function check_user()
{
if (!is_user_logged_in()){
die("You Must Be Logged In to Access This");
}
if( ! current_user_can('edit_files')) {
die("Oops sorry you …Run Code Online (Sandbox Code Playgroud) 如何使用php curl检测此错误?即使URL不存在,curl也会返回成功.
Not Found
The requested URL /foo/index.php/items/edit was not found on this server.
Run Code Online (Sandbox Code Playgroud)
我的代码
$post_fields = array('info' => json_encode($fields));
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($post_fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_fields);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLINFO_CONTENT_TYPE,'application/x-www-form-urlencoded charset=utf-8');
$result = curl_exec($ch);
echo $result;
if(curl_error($ch)){
$result = curl_error($ch);
curl_close($ch);
return $result;
}else{
curl_close($ch);
return json_decode($result,true);
}
Run Code Online (Sandbox Code Playgroud) Vs'12互联网应用模板+ KendoUI - MVC4,EF Code First
<compilation debug="false" targetFramework="4.5">从真实变为虚假我在哪里重新编写代码并让它在实际位置查找精灵而不是这个?:获取http://cls-og.com/bundles/css/Default/sprite.png 404(未找到)
deployment rendering http-status-code-404 asp.net-mvc-4 kendo-ui
我的项目名为homefood,当我运行server时,我得到了这个错误.任何人都有任何线索如何解决这个错误.
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/
Using the URLconf defined in homefood.urls, Django tried these URL patterns, in this order:
^foodPosts/
^admin/
The current URL, , didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
Run Code Online (Sandbox Code Playgroud)
我的settings.py文件看起来像这样......
import dj_database_url
"""
Django settings for homefood project.
# Build paths inside the project like this: …Run Code Online (Sandbox Code Playgroud) 我已成功将我的Symfony 2应用程序部署到Heroku但现在,当我尝试访问它时,我收到以下403错误:
被禁止
您无权访问此服务器上的/.
这是Heroku的日志:
2015-07-29T14:31:41.827491+00:00 heroku[router]: at=info method=GET path="/" host=my-app.herokuapp.com request_id=557a70f4-ea11-4519-b8df-301b714f6ffa fwd="151.77.103.253" dyno=web.1 connect=0ms service=1ms status=403 bytes=387
2015-07-29T14:31:41.828428+00:00 app[web.1]: [Wed Jul 29 14:31:41.827438 2015] [autoindex:error] [pid 104:tid 140466989270784] [client 10.100.0.139:16096] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
2015-07-29T14:31:41.829009+00:00 app[web.1]: 10.100.0.139 - - [29/Jul/2015:14:31:41 +0000] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Run Code Online (Sandbox Code Playgroud)
似乎Symfony(或Heroku?)正在尝试提供目录,/app/但我认为这是不正确的,如日志:
2015-07-29T14:31:41.828428 + …
php heroku http-status-code-403 http-status-code-404 symfony
我在路由器文件中删除了历史模式链接中的hashbang.现在,当我刷新页面时,我收到了404错误.
我试着按照这个链接
然后,我在firebase.json中添加了部分:
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
然而一切都没有改变.
我不明白为什么我还有这个错误.我尝试了很多东西,但我找不到解决它的东西.
这是我的路由器文件:
const router = new VueRouter({
mode: 'history',
routes: [
{
path: '/',
redirect: '/catalog'
},
{
path: '/catalog',
name: 'Catalog',
component: Catalog
},
{
path: '/catalog/category/:category',
name: 'ProductsList',
component: ProductsList
},
{
path: '/catalog/category/:category/product/:id',
name: 'ProductDetail',
component: ProductDetail,
},
{
path: '/catalog/category/:category/product/create',
name: 'CreateProduct',
component: CreateProduct
}
]
});
Run Code Online (Sandbox Code Playgroud) Image.network网址错误或目的地指向404时如何处理。
例如尝试
Image.network('https://image.tmdb.org/t/p/w92')
Run Code Online (Sandbox Code Playgroud) 我想检查答案是否正确。响应码为 200 或 500 时正确。后者需要区分响应正文中的字符串是正确的还是不正确的。它应该在单个测试中。
我已经尝试过简单的 if 子句,但它们不起作用。
pm.test("response is ok", function(){
if(pm.response.to.have.status(200)){
//do things
}
});
Run Code Online (Sandbox Code Playgroud)
我使用的解决方案是
pm.test("response is valid", function(){
if(pm.response.code === 200){
//is ok
} else if (pm.response.code === 500){
if(pm.expect(pm.response.json().message).to.include("xyz")){
//is ok
} else {
pm.expect.fail("Error 500");
}
} else {
pm.expect.fail("statuscode not 200 or 500");
}
Run Code Online (Sandbox Code Playgroud)
});
php ×3
url ×2
.htaccess ×1
apache ×1
asp.net-mvc ×1
curl ×1
deployment ×1
django ×1
django-urls ×1
firebase ×1
flutter ×1
heroku ×1
http ×1
javascript ×1
jquery ×1
kendo-ui ×1
nginx ×1
permalinks ×1
php-curl ×1
postman ×1
python ×1
rendering ×1
symfony ×1
testing ×1
vue.js ×1
vuefire ×1
vuejs2 ×1
wordpress ×1