我使用以下代码来显示客户端上的服务器的异常消息:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static void test(String text)
{
try
{
throw new Exception("Hello");
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
throw new Exception(ex.Message, ex.InnerException);
}
}
Run Code Online (Sandbox Code Playgroud)
客户端:
$.ajax({
url: 'DownloadFile.aspx/test',
type: 'POST',
contentType: 'application/json; charset=utf-8',
// Pass the value as JSON string
// You might need to include json2.js for the JSON.stringify
//method: 'http://www.json.org/json2.js',
async: false,
dataType: "json",
data: '{ "text": "' + text'"}',
success: function(Result) {
},
error: function(xhr, textStatus, errorThrown) {
var err = eval("(" + …Run Code Online (Sandbox Code Playgroud) 我想在会话超时后从我网站的每个页面重定向到登录页面.我尝试将window.location设置为登录页面:
var ParentUrl = encodeURIComponent(window.parent.location.href);
document.location.href = "~/Login.appx?ReturnUrl=" + ParentUrl;
Run Code Online (Sandbox Code Playgroud)
但"〜"似乎没有得到支持.我的登录页面位于我的根文件夹下.
例如:*http:// server/website /*Login.aspx
如何在javascript中获取此URL?
非常感谢,
英巴尔.
我有一个包含许多标签的html文件.
我想在滚动事件上加载图像,并卸载不可见的图像.就像在Aamzaon查看器中一样,当您向上/向下滚动时,框架中的当前图像是延迟加载的.
我看到了很多LazyLoad工具,但是没有一个工具具有卸载功能.
我有未签名的Pem证书。当我使用openssl查看证书时,我得到签名算法:itu-t(使用x509Certificate我得到0.0)
itu-t是什么意思?我知道证书没有签名。
我有一个带有图像的 HTML:
<img id="1" .../>
<img id="2" .../>
<img id="3" .../>
<img id="4" .../>
Run Code Online (Sandbox Code Playgroud)
打印时,我希望每个图像都位于单独的页面上(根据打印尺寸)。
现在我把图像从中间切掉了。
有什么办法可以解决吗?