如何使用ASP.NET获取网页内容?我需要编写一个程序来获取网页的HTML并将其存储到字符串变量中.
这是我的视图代码我使用jquery它工作,我没有任何问题,直到我更改它停止工作的屏幕分辨率.我知道问题在哪里,但我无法解决它看代码:
@model PNUBOOKIR.Models.ProductModels
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<script src="@Url.Content("~/Scripts/jquery.js")" type="text/javascript"></script>
<script type="text/javascript">
var endRun = false;
var PageNO = 1;
$(window).scroll(function () {
if ((($("#container").outerHeight() - 796) == ($(this).scrollTop())) && (!endRun)) {
endRun = true;
Load();
}
});
$(document).ready(function () {
Load();
return false;
});
function Load() {
var BtnShowMore = document.getElementById("BtnShowMore");
BtnShowMore.innerHTML = "Loading...";
$.ajax({ type: "Post",
url: "Product" + "/" + "GetHomeEventAjax",
data: "{" + "PageNO" + ":" + PageNO + "}", …Run Code Online (Sandbox Code Playgroud) 我在mvc 4.0应用程序和我的参考中使用了验证码:Asp.Net MVC CAPTCHA
但它实现基于mvc 2.0它显示一个图像,但在控制器中我没有任何OnPreAction方法我用OnAuctionExcuting替换它,但它没有MethodInfo.如何更新代码以在mvc 3.0或4.0上运行?
我有一个奇怪的情况,我的jquery.post返回代码#200(OK),但错误处理程序被命中.
这是我的MVC WebAPI服务器端代码(它所做的只是返回代码#200 OK):
[HttpPost]
public HttpResponseMessage Post(T input)
{
//_handler.Create(input);
return Request.CreateResponse(HttpStatusCode.OK);
}
Run Code Online (Sandbox Code Playgroud)
这是我的客户端脚本
ServerAccess.prototype.Save = function (m) {
$.post("http://localhost:55482/M/", m)
.success(
function (o) {
alert("success");
})
.error(
function (xhr, textStatus, errorThrown) {
if (typeof console == 'object' && typeof console.log == 'function') {
console.log(xhr);
console.log(textStatus);
console.log(errorThrown);
}
}
);
};
Run Code Online (Sandbox Code Playgroud)
Firebug中的控制台输出是:
POST
http://localhost:55482/M/200 OK 894ms头
响应标题
内容长度6
Content-Type application/json; 字符集= utf-8的
Date Sun,28 Oct 2012 18:55:17 GMT
服务器Microsoft-HTTPAPI/2.0
请求标题
接受 /
Accept-Encoding gzip,deflate
Accept-Language nb-no,nb; q …
我设置了密码"13579"并且身份验证模式将其转换为MD5,如"mEXg8klnq0TwPFvAqytULA ==",但经过几分钟后,我再次尝试使用相同的密码"13579"创建另一个,但它转换为不同的密码,如"uM4gH8HO8cvoE0slg6OyKA =="MD5的结构是什么?它与我的用户名和时间有关吗?我想为我的用户创建相同的密码,因此如果它取决于时间我就无法创建相同的密码.
这是我的根控制器:
[HttpPost]
public ActionResult Index()
{
}
Run Code Online (Sandbox Code Playgroud)
但它无法加载它给我的项目:
无法找到该资源.说明:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用.请查看以下网址,确保拼写正确.
我从网站转移到Web应用程序来改进它,我在我的网站上有个人资料.
我的个人资料不起作用,所以我实现System.Web.ProfileProvider并创建一个类ProfileCommon继承ProfileBase我使用HttpContext.Current.Profile.SetPropertyValue和GetPropertyValue.它的工作原理,但问题是它有一个逻辑错误,因为HttpContext.Current.Profile不会调用我的ProfileProvider方法我怎么能修复它?或者在Web应用程序中是否有任何其他的配置文件实现?
public class ProfileCommon : ProfileBase
{
public string FirstName
{
get
{
return HttpContext.Current.Profile.GetPropertyValue("FirstName").ToString();
}
set
{
HttpContext.Current.Profile.SetPropertyValue("FirstName", value);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在web.config中
<profile inherits="BaniBookWebApp.Code.Core.ProfileCommon">
<providers>
<add name="CustomProfileProvider" type="BaniBookWebApp.Code.Core.CustomProfileProvider"/>
</providers>
</profile>
Run Code Online (Sandbox Code Playgroud)
CustomProfileProvider:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using eLearn2Model;
using System.Collections;
using System.Configuration;
namespace AccessControl
{
public class ProfileProvider : System.Web.Profile.ProfileProvider
{
public ProfileProvider()
{
}
public override int DeleteInactiveProfiles(System.Web.Profile.ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
int res = -1;
using (var db = new eLearn2Entities())
{ …Run Code Online (Sandbox Code Playgroud) 我需要在我的网络应用程序中将时间转换为"UTC + 03:30时区"这里是UTC日期:
DateTime dt = DateTime.UtcNow;
Run Code Online (Sandbox Code Playgroud)
有没有将UTC转换为我的时区的功能?如果ASP.NET中有一个函数,我不想让自己在我的应用程序中编写一个新函数.
该应用程序可能托管在世界上的不同服务器中,这正是我使用UTC日期的原因.
我需要一个函数将3:30加到当前的UTC时间.
有多少用户可以同时打开与Microsoft Access数据库的连接?我使用asp.net 4.0编写我的应用程序.
<add name="E_ShopAccessConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\report.mdb;Persist Security Info=True" providerName="System.Data.OleDb"/>
Run Code Online (Sandbox Code Playgroud) 我如何将linq查询作为字符串发送到Entity Framework,例如:
from s in students select s
Run Code Online (Sandbox Code Playgroud)
我想在oracle和sql server中编译它
c# ×5
asp.net ×4
asp.net-mvc ×2
jquery ×2
.net ×1
cross-domain ×1
javascript ×1
jquery-post ×1
linq ×1
md5 ×1
ms-access ×1