Questions tagged [httpcontext]

HttpContext is a class from .NET Framework which provides information about an HTTP request.

HttpContext is a class from .NET Framework which provides information about an HTTP request.

1046 questions
0
votes
1 answer

Trying to get session from a static method, but getting NULL

i am trying to get the current user session from a static function, but the usObj is always null. here is what i'm doing: public static List GetRequestType(string itemNo, int requestTypeID, int claimID) { UserSession usObj =…
Madam Zu Zu
  • 6,025
  • 16
  • 74
  • 122
0
votes
3 answers

the value of "User.Identity.Name" on asp.net mvc 3

i work on web app using asp.net mvc 3 , the problem is with the variable "User.Identity.Name" taht return name and not UserId . have you already this problem ?
ucef
  • 537
  • 3
  • 10
  • 25
0
votes
2 answers

HTTPContext.Current problems - am I using it correctly?

I have a feeling I'm using HttpContext.Current incorrectly, based on some strange code output. I have two pages, http://example.com/Foo.aspx, and http://example.com/Bar.aspx. Both have a button that, when clicked, calls a static function in a class…
Chris
  • 3,952
  • 4
  • 40
  • 72
0
votes
2 answers

ASP.NET HttpContext exclusive values for each user

I am creating a project using ASP.NET MVC 3. So now I need to pass some data that need to be available into the entire project. I am using IHttpModule and set values in the HttpContext items. My doubt is, the values I add into HttpContext items will…
Michel Andrade
  • 3,377
  • 5
  • 25
  • 26
0
votes
2 answers

Error on HTTP Stream PHP

I have this method: protected function _sendRequest($url, $method, Busca_Cxense_Data $data, $get = null) { if (! isset ( $this->_urls [$url] )) { throw new Busca_Cxense_Exception_Argument ( "El tipo de url enviado no es valido. (type:…
Cito
  • 1,577
  • 3
  • 18
  • 47
0
votes
2 answers

How to fetch the current logged in user in Mvc3

Hi i need to fetch the id of the live user and i am able to do it.but the problem arises when i switch from one Port to another it does not fetch the user on another port I have done this: public static Nullable GetLiveUser() { if…
user1274646
  • 851
  • 6
  • 19
  • 46
0
votes
1 answer

I'm using the Unit of Work Pattern in my DAL, but I need to perform data access in Application_Start. What should I do?

Given: When using the Unit Of Work pattern with an ORM in ASP.NET, the UnitOfWork object holds a reference to HttpContext. Question: But what if I need to perform some data access in Application_Start (especially in IIS7)? Is the Unit Of Work…
Jim G.
  • 14,056
  • 19
  • 94
  • 153
0
votes
2 answers

Open a file when it downloads with HttpContext

I have a handler that I call when a link gets clicked. This handler gets the file contents from the DB and writes the contents to context.Response. I'd like to open this file as well along with it getting downloaded. Is this possible?
neuDev33
  • 1,473
  • 7
  • 37
  • 54
0
votes
1 answer

How to create a session between client and self-hosted WCF service

My goal is to keep track of clients with cookies and their sessions. This is needed because I don't like WCF's builtin authentication process, where they are just give the generic login popup in the browser [1]. I'm looking to have a login page…
ymerej
  • 650
  • 1
  • 8
  • 20
0
votes
2 answers

Controller User is null

I am pretty new to MVC and am having difficulties getting my application to run on my staging webserver. On my local machine and dev server it is running fine. The issue is that in my Action the User is null (on staging, not on dev and local). I…
-1
votes
1 answer

How to add a custom HttpContextAccessor to service ASP.NET Core

I want to add custom HttpContextAccessor to service in asp.net core, is this the correct way: at ConfigureService method: var env = services.BuildServiceProvider().GetRequiredService(); Then adding…
ikenahim
  • 75
  • 9
-1
votes
3 answers

.NET Core Middleware - access IApplicationBuilder in a controller?

I need to access IApplicationBuilder inside a controller. What I have tried :- I have written middleware (app.UseMyMiddleware) as follows // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public…
Harish Shisode
  • 549
  • 3
  • 14
-1
votes
2 answers

C# Export to Excel from class

I am following the following an example to Export data from table/stored proc to Excel. https://www.c-sharpcorner.com/UploadFile/rahul4_saxena/how-to-export-multiple-data-tables-to-multiple-worksheets-in/ The only difference is that since I have an…
SilverFish
  • 796
  • 3
  • 18
  • 40
-1
votes
2 answers

How to get initial timestamp of a http request in golang?

I am writing a golang program using revel framework, in which i need to check the initial timestamp of a http request. I know how to do it in C# : HttpContextWrapper context = Request.Properties["MS_HttpContext"] as HttpContextWrapper; DateTime t2…
-1
votes
1 answer

Get Values from ResultExecutedContext result

How can I get values from ResultExecutedContext result? In the debug I can see there are values: But the intelisense doesn't see it.
mskuratowski
  • 3,692
  • 8
  • 46
  • 94
1 2 3
69
70