在IIS7 .NET 3.5坏请求错误400 [英] Bad Request Error 400 on IIS7 .NET 3.5

查看:168
本文介绍了在IIS7 .NET 3.5坏请求错误400的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的IIS7错误请求错误400。我有恩的URL字符串codeD特殊字符。我的URL看起来像这样(不喜欢%26):

I am running into a bad request error 400 on IIS7. I have encoded special characters in the URL string. My URL's look something like this (doesn't like %26):

http://www.myjobs.com/a/q-Barnes+%26+Noble

这将是,如果我是在.NET 4.0中运行一个简单的办法,但我对Rackspace的云只能运行在IIS7 .NET 3.5。

This would be an easy fix if I were running on .NET 4.0, but I am on rackspace cloud and can only run on IIS7 .NET 3.5.

这是我在我的web.config中使用的,如果我是在IIS7 .NET 4.0:

This is what I would use in my web.config if I were on IIS7 .NET 4.0:

requestPathInvalidCharacters=""

在IIS7运行,并且时有什么其他选择有.NET 3.5?

What other options are there when running on IIS7 and .NET 3.5?

推荐答案

为什么连接code特殊字符到URL中呢?

Why encode special characters into the URL at all?

为什么不他们全部转换成一个只有字母数字字符和破折号更加搜索引擎友好的形式存储在数据库的特殊形式。或者更简单,在URL中包含的ID,并使用后期只是为了让人类可读和搜索引擎友好的:

Why not convert them all to a more SEO-friendly form that has only alphanumeric characters and dashes and store that special form in your database. Or, even easier, include the ID in the URL and use the latter part just to make it human readable and SEO-friendly:

例如。 www.myjobs.com/a/1234/q-Barnes-and-noble

e.g. www.myjobs.com/a/1234/q-Barnes-and-noble

这个方法也意味着你可以改变你的编码(可能增加一些新的特殊字符字母映射),并没有任何404的。

This approach also means you can change your encoding later (maybe add some new special character to alpha mapping) and not have any 404's.

这篇关于在IIS7 .NET 3.5坏请求错误400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆