E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
HttpContext
Cookie和Session的详细使用方法
cookie.Value="蝈蝈";//HttpCookiecookie=newHttpCookie("UserId","蝈蝈");cookie.Expires=DateTime.Now.AddMinutes(2);
HttpContext
.Current.Response.App
changuncle
·
2020-07-09 01:47
C#基础
asp.net 使用 Cas 单点登录 配置
defaultUrl="Default.aspx"cookieless="UseCookies"slidingExpiration="true"/>或者用户,验证登录publicvoidLogin(){if(
HttpContext
.Curren
wzsdoors
·
2020-07-09 01:32
C# 通过word模板动态生成Word
_ApplicationoWord=newWord.Application();oWord.Visible=false;objectoTemplate=
HttpContext
.Current.Server.MapPath
weixin_34320724
·
2020-07-08 17:28
httpContext
.User.Identity.IsAuthenticated 总是为fasle
验证一直通不过,不知道问题在哪里。这个坑应该只有我自己遇到,记录一下,问题在使用swagger验证的时候出现的(说的很轻松)如图所示,在swaager文档中,添加认证功能,此时只要我们填下登陆时获取的token,便能访问到其他接口。如下图填写密钥如果密钥没有填对,则对接口有认证的地方进行校验,效验失败则返回如下刚开始不知道验证失败的原因在哪里。一直在查阅认证与授权的资料。尝试了其他项目,发现都是正
weixin_30650859
·
2020-07-08 14:04
Post方式提交,通过上下文
HttpContext
,Request[""]获取
问题场景如下:在项目的一般处理程序中,所有方法都是通过《context.Request["参数名"].ToString()》来获取参数的值。如果我直接将参数追加到URL后面,直接Post,后台是可以通过context.Request["参数名"].获取到参数值的,但是当我将参数放到请求的Body里中后,后台再这样获取就无法读取到参数。只能通过读流的方式,获取到参数。因为这个项目是前人留下来的,所以
weixin_30376083
·
2020-07-08 13:32
缓存通用管理类 + 缓存
HttpContext
.Current.Cache 和 HttpRuntime.Cache 的区别
以前写asp.net时用
HttpContext
.Current.Cache存缓存很好用,今天写了一个windows服务程序,
HttpContext
.Current.Cache存缓存的时候还好,取的时候一直报错
weixin_30257433
·
2020-07-08 13:35
GridVew数据导出到Wrod、Excl
数据信息//////类型///名称.后缀///控件名称publicstaticvoidExport(stringFileType,stringFileName,GridViewgv){System.Web.
HttpContext
.Current.Response.Ch
li574556892
·
2020-07-07 13:10
.net 用aspx作接口接收postman的访问数据(json)
是用xml作为底层传输数据的格式碰到那种一定要求使用json格式的情况就比较麻烦可以用aspx响应请求(效率不是很好,毕竟是页面类型)stringpostString=string.Empty;if(
HttpContext
.Current.Request.HttpMethod.ToUpper
jiidd
·
2020-07-07 11:01
.net
asp.net mvc Filter拦截跳转
if(filterContext.
HttpContext
.Session["userId"]==null){filterContext.
HttpContext
.Response.Redirect("~/
_天空之城
·
2020-07-07 09:11
C#获取客户端Ip和MAC地址
获取客户端IPpublicstaticstringGetClientIp(){if(System.Web.
HttpContext
.Current.Request.ServerVariables["HTTP_VIA
zhouqinxiao
·
2020-07-06 12:20
C#
HttpWebRequest使用post上传数据,webapi接收
前端传一个json对象,后端用字典接收byte[]data=newbyte[
HttpContext
.Current.Request.InputStream.Length];
HttpContext
.Current.Request.InputStream.Read
微机原理通识
·
2020-07-06 03:41
.net
解决C#导出execl中文乱码问题!
解决办法:Response.Clear();Response.Buffer=true;
HttpContext
.Current.Response.Charset="UTF-8";
HttpContext
.Current.Response.ContentEncoding
weixin_34184561
·
2020-07-06 00:08
为什么获取的System.Web.
HttpContext
.Current值为null,
HttpContext
对象为null时如何获取程序(站点)的根目录...
ASP.NET提供了静态属性System.Web.
HttpContext
.Current,因此获取
HttpContext
对象就非常方便了。
weixin_34124577
·
2020-07-06 00:07
asp.net web api 跨域,带cookie
默认是不支持跨域的,如果你从一个域访问另一个域的api虽然是200,但是什么东西都没有返回在api的响应头上加入
HttpContext
.Current.Resp
weixin_33711647
·
2020-07-05 22:25
C#中POST数据和接收的几种方式(抛砖引玉)
这里介绍另外一种POST方式和接收方式,就是将整个数据作为加入到数据流中提交和接收接收方式:Streams=System.Web.
HttpContext
.Current.Request.InputStream
weixin_30782331
·
2020-07-05 21:46
asp.net 关于SessionId
存储验证码,导致会话产生SessionId,从而导致会话固定,登陆后用来存储用户信息的SessionId不变,容易被利用//强行销毁当前用户的所有会话内容,但是只有加载页面的时候有效,导致登陆后没有用户信息
HttpContext
.Current.Session.Aband
weixin_30449239
·
2020-07-05 20:14
[转]C#中POST数据和接收的几种方式
这里介绍另外一种POST方式和接收方式,就是将整个数据作为加入到数据流中提交和接收接收方式:Streams=System.Web.
HttpContext
.Current.Request.InputStream
weixin_30323631
·
2020-07-05 20:25
c#发送和接收get,post消息
c#后台获取post消息,get消息就用Request.QueryString[“key”]if(
HttpContext
.Current.Request.HttpMethod.ToUpper()=="POST
winsee1
·
2020-07-05 17:47
c#
asp.net mvc 通过api来实现websocket通信
创建API控制器MessageSendController;在控制器下创建GET方法来实现websocket的初始化,首选判断前端访问时发是websokcet访问if(
HttpContext
.Current.IsWebSocketRequest
Jeans028
·
2020-07-05 15:06
.Net
C#webapi接收app发送的post请求,包括数据和图片
【1】
HttpContext
获取http请求HttpContextcontext=
HttpContext
.Current;在业务层需要取得当前页面层的Session,Request,Response,Server
u010082526
·
2020-07-05 15:02
C#
webapi
HttpContext
.Current.Session 和 Session 的区别
如果你在Reflector反编译软件中查看这个公共属性的代码,你会看到这个属性自己仅仅是调用的
httpcontext
.current.session而
24600981
·
2020-07-05 03:45
在Handler中使用Session
在Handler中使用Session的时候是从
HttpContext
中去取的,那么用Reflector直接去找到
HttpContext
,看他是如何做到的,把整个类用ReflectorDisassembler
记得微笑
·
2020-07-05 02:15
.NET
C#
C# .net判断访问来源是否是智能手机
//////根据Agent判断是否是智能手机//////publicstaticboolCheckAgent(){boolflag=false;stringagent=
HttpContext
.Current.Request.UserAgent
ppatzhang
·
2020-07-05 02:27
C#
winform
ashx一般处理文件接收前端传来的参数
result){});接收方式:1.对象方式前端传来的如果是from表单封装成的json数据,以表单中各项的name属性对应名字新建一个实体类,如图:然后引入Newtonsoft.Json,varjson=
HttpContext
.Current.Request
话说要不
·
2020-07-04 21:08
C#
json
C#的远程post接收与请求
//接收Streamstream=
HttpContext
.Current.Request.InputStream;byte[]getByte=newbyte[stream.Length];stream.Read
圆圆娃哈哈
·
2020-07-04 21:04
c#
ASP.NET Core 自定义响应报文头
HttpContexthttpContext){//setHeadershttpContext.Response.Headers.Add("Server",newStringValues("Apache-Coyote/1.1"));
httpContext
.Response.Headers.Add
芸芸众生无名之辈
·
2020-07-04 17:08
ASP.NET
Core
IHttpHandler session问题
System.Web.
HttpContext
.Current.Session["userinfo"];但是今天此种方法也失灵了。在做一个小应用时,需要实现IHttpHandler,同时也需要用到用户的
fox123871
·
2020-07-04 15:51
ASP.NET
C#
Asp.net 实现只能允许一个账号同时只能在一个地方登录
publicclassSSOHelper{//////登录后执行//////用户标识publicvoidLoginRegister(stringUserID){HashtablehOnline=(Hashtable)System.Web.
HttpContext
.Current.Application
dianzhen5713
·
2020-07-04 14:20
一般处理程序ashx的post请求
ashx可直接获取
HttpContext
对象,虽然很灵活,但也导致操作有些许复杂,Content-Type和RequestBody与mvc、webapi的不同。
冬冬冬冬冬冬冬冬冬冬
·
2020-07-04 12:35
C#
web
js
C# 根据时间创建文件夹
Directory.Exists(
HttpContext
.Current.Server.MapPath("~/admin/upload/")+((fileNameIndex)index).ToString
a18770840362
·
2020-07-04 10:35
System.Web.
HttpContext
.Current.Session为NULL值的问题?
自定义HTTP处理程序,从IHttpHandler继承,在写System.Web.
HttpContext
.Current.Session["Value"]的时候,没有问题,但想将这个Session写到某个变量时或判断是否为空时如
小白不准占用
·
2020-07-04 06:35
webservice
session
C#.NET后台读取服务器文件名称,并下载到本地
protectedvoidbtndown_Click(objectsender,EventArgse){LinkButtonbb=(LinkButton)sender;stringfilename=bb.Text;//获取文件名称stringdir=
HttpContext
.Current.Request.PhysicalApplicationPath
zivzang
·
2020-07-04 05:41
C#
working
note
IHttpHandler中使用Session实现原理
工具Reflector正文在Handler中使用Session的时候是从
HttpContext
中去取的,那么用Reflector直接去
weixin_33924220
·
2020-07-04 02:32
c# post 接收传来的文件
privatevoidUploadFile(){////......其他代码//HttpFileCollectionfiles=
HttpContext
.Current.Request.Files;if(
weixin_30757793
·
2020-07-04 02:17
Cookie的写入,和读取
publicstaticvoidSetLoginGmameInfo(stringuid,stringsid,stringtimestring,stringsign){//System.Web.
HttpContext
.Current.Session
lm18307210047
·
2020-07-02 09:34
Asp.net
MVC基础知识整理
MVC5为例,涉及到的知识有:Model-View-Controller的使用、Area和Global的理解、路由配置、数据传递的方式、AOP思想的体现(4大过滤器),各种Result、Razor语法、
HttpContext
昵称全重复
·
2020-07-02 09:21
MVC
.net core 验证器(filter)读取post请求参数
1.权限(AuthorizationFilters)验证器中读取并只读取有一次请求串的方法HttpRequestrequest=context.
HttpContext
.Request;//post请求方式获取请求参数
confused_kitten
·
2020-07-01 20:07
.net
core
ASP.NET MVC知识点
HttpContext
,HttpContextBase,HttpContextWrapper联系HttpContextHttpContext是最原始的ASP.NETContext.MVC的目的之一是能够单元测试
风神修罗使
·
2020-07-01 14:16
ASP.NET
MVC4
MVC5
asp.net 4.0+jquery easyui 导出excel
,需要做导出excel,其实这个很简单的,刚开始的时候调用错误导致执行到Response.End();报“由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值”错误,根据网上的代码修改成
HttpContext
.Current.ApplicationInstance.CompleteRequest
睿智天成
·
2020-07-01 12:17
jquery
ui
excel导出
easyui
asp.net
使用NPOI导出Word时插入图片
string[]imgPath=path.Split(',');for(inti=0;i
HttpContext.Current.Server.MapPath
星~空
·
2020-06-30 13:26
(asp.net)今日学习笔记
今天在自己的毕业设计中加入了rss功能,具体实现:System.Web.
HttpContext
.Current.Request.Url.Host//获得主机目录Request.ApplicationPath
啊啊奔驰车
·
2020-06-30 11:05
ASP.NET
根据ip定位到你的城市
string.IsNullOrEmpty(
HttpContext
.Request.ServerVariables["HTTP_VIA"]))IsNullOrEmpty:判断字符串是空引用,或者值为空。
乔乔zuibang
·
2020-06-30 04:22
地图
c#根据上一个页面的URL来判断该页执行那一部分代码
protectedvoidPage_Load(objectsender,EventArgse){//根据上一个URL判断该执行那部分代码stringurl=
HttpContext
.Current.Request.UrlReferrer.ToString
weixin_44376592
·
2020-06-29 12:58
asp.net获取访问者ip地址的函数
//////获取IP地址///publicstaticstringIPAddress{get{stringuserIP;//HttpRequestRequest=
HttpContext
.Current.Request
weixin_34416649
·
2020-06-28 19:57
Office 2007 打开 C# VS2005 导出的Excel时报错:单元格数据太大 Office 2003打开正常 的解决办法...
:导出Excel的代码:privatevoidExportToExcel(){Response.Clear();System.Web.HttpContextcurContext=System.Web.
HttpContext
.Current
weixin_34407348
·
2020-06-28 19:18
无法找到System.Runtime.Serialization.Json的奇怪问题
昨天在开发时遇到一个很简单但是很奇怪的问题if((filterContext.
HttpContext
.Request.ContentType??
weixin_34380781
·
2020-06-28 18:15
c# 调用微信小程序
stringiv,stringencryptedData)2{3//context.Response.ContentType="text/plain";4stringxx="";5try6{7//code=
HttpContext
.Current.Request.QueryStrin
weixin_34375233
·
2020-06-28 18:59
ASP.NET基础之
HttpContext
学习
上一个随笔主要针对HttpModeul[ASP.NET基础之HttpModule学习]内容进行一个简单的学习;本章内容我将对ASP.NET另一个主要的知识点
HttpContext
进行学习;首先我们简单了解一些理论的知识
weixin_34179968
·
2020-06-28 12:53
如何手动让HttpRequestBase.IsAuthenticated 和
HttpContext
.User.Identity.IsAuthenticated 为true....
今天为了重写权限验证这块需要重写AuthorizeAttribute这个属性,看了官方文档:HttpContextBase.User.Identity.IsAuthenticated这个必须是true才能跑的通,我又去查如何让这个为true,后来进入了误区,准备重写IIdentity和IPrincipal接口,但是很蛋疼的是需要重写:Application_PostAuthenticateRequ
weixin_33913332
·
2020-06-28 08:57
日志
=
HttpContext
.Current){path=
HttpContext
.Current.Server.MapPath("~/Sys
weixin_33912246
·
2020-06-28 07:40
上一页
3
4
5
6
7
8
9
10
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他