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.

1127 questions
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,573
  • 7
  • 41
  • 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
  • 727
  • 1
  • 8
  • 21
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
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
  • 1,014
  • 6
  • 28
  • 65
-1
votes
1 answer

HttpContext.Current.Server threw an exception of type System.NullReferenceException when I deploy to my server

For some reason after deploying the same code that works perfectly on localhost to my server this line fails: private static string nodePath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["NodeJS.Path"]); The original…
Alejandro Lozdziejski
  • 1,063
  • 4
  • 12
  • 30
-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
  • 4,014
  • 15
  • 58
  • 109
-1
votes
1 answer

Error JobRunShell.cs not found at HttpContextWrapper

I using Quartz .NET to execute code every minute and also refresh Index page after code execution, Quartz working fine to execute code but error while redirect to Index page (UI). Complete code is : Startup.cs public void Configuration(IAppBuilder…
Shri
  • 351
  • 3
  • 16
-1
votes
1 answer

Writing XML file to Users Browser and download

I am writing XML data to the user browser for download. Below is the code protected void WriteXmlToPageDownload(XElement XmlCustomerData) { try { if (XmlCustomerData != null) { …
Troy
  • 11
  • 3
-1
votes
1 answer

httpContext User Identity

I would like to restrict user's access on my website based on the the User Identity and I used following code its works fine in Visual Studio but when I am publishing into IIS sending userIdentity= NULL to Database. Dim httpContext__1 As…
ABM Abdul Muttalib
  • 195
  • 1
  • 2
  • 13
-1
votes
1 answer

Error when accessing resource file in method with parameter key

I'm trying to access my global.resx file from a static method... this is what i have public static string GetElementTextLabel(string attributeName) { string retValue = string.Empty; try { retValue = (string)…
fifamaniac04
  • 2,343
  • 12
  • 49
  • 72
-1
votes
1 answer

how to test form submission in mvc

I'm sending some param via form post from my template and the action in my controller is handling it accordingly. Now I want to write a test case for that action. How should I make that dummy request so that Request.Form["selectedSuppliersHidden"]…
-1
votes
1 answer

session in class file

Hi I have a list called Event Source. In that am adding new item. Once i added , the background process takes this newly created id and start importing EventFields in the Specific List.In EventSource list item i have an ECB menu item called Sync and…
user2518802
  • 21
  • 1
  • 7
-1
votes
2 answers

Getting the user's local IP - Always getting 192.168.2.1

I need to get the user's local IP for my ASP.NET application and I'm using this method: protected string GetIPAddress() { System.Web.HttpContext context = System.Web.HttpContext.Current; string ipAddress =…
user1761123
-1
votes
2 answers

HttpContext.Current NullReferenceException in asp.net MVC

I have 2 RAZOR Index forms in my application. 1 Form creates records in one database "LocalDB" and updates the same record in another database "Core DB". Another Form sync records from "CoreDB" to "LocalDB". Have to do this because there are other…
Vivek Patel
  • 349
  • 2
  • 4
  • 21
-2
votes
2 answers

Null in context.Request

How to allow null in Context.Request: context.Response.Write(retrieveList(context.Request["SalCode"].ToString(null), context.Request["groupKeyword"].ToString(), context.Request["text"].ToString()));
ChristineS
  • 503
  • 1
  • 6
  • 12
1 2 3
75
76