Web Forms :: Cannot Obtain Request.ServerVariables From Thread

Aug 15, 2010

I am trying to run this log routine in a separate thread in order to improve page load performance but I am getting an error in the line bellow: "object not set to an instance of a variable".

line error: strTempBrowser = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"].ToString();

I am suspecting that Request.ServerVariables are not available during the time that the thread executes. Is there a workaround?

Page Base Class
//STATISTICS
SiteStatisticsLite sStat = new SiteStatisticsLite();
Thread oThread = new Thread(new ThreadStart(sStat.AddLog));
oThread.Start(); // Don't wait to finish, just let stat logging to occurr after page loads
public class SiteStatisticsLite
{
//SiteStatisticsLite sStat = new SiteStatisticsLite();

View 2 Replies


Similar Messages:

Web Forms :: Get Hash From Request.servervariables?

Feb 9, 2011

I need to get the Hash value from url. Example:

Photos.aspx?area=photo&Id=2#22

Get the 22 after #.

How can this be done easily.

IN ASP.NET and not Javascript

View 1 Replies

Web Forms :: Get Server / Domain Name Without HttpContext.Current.Request.ServerVariables?

Jul 28, 2010

In an asynchronous process, I need to get the name of the domain/server the web application is running on. But in that situation HttpContext.Current is not available, so I cant use HttpContext.Current.Request.ServerVariables("SERVER_NAME").

View 7 Replies

Request.ServerVariables Not Updated When Simultaneous Login From 2 Machines

Dec 7, 2010

I'm using IIS 7.0 on WS2008. I've implemented a simple login page that redirects to another simple page showing the Request.ServerVariables key/values. I'm using the built-in SQL membership provider. The website is on a DEV machine and there are no users on it.

When I login at the same time with 2 different users from 2 different locations (2 different public addresses) then one of the Request.ServerVariables page is the same as the other. That includes the client IP address which is then completely wrong. The authentication as well as the other cookies are wrong as well.

I checked the IIS log and it shows the correct client address as well as the correct login name. If I then reload the wrong page I get the correct data. Is there some concurrency issue in ASP.NET? I disabled the session and caching but I still get the same behaviour.

View 1 Replies

C# - Use Request.UrlReferrer And When Request.ServerVariables["HTTP_REFERER"]?

Aug 25, 2010

Both returns the incoming url, Just to know When to use Request.UrlReferrer and when Request.ServerVariables["HTTP_REFERER"] and why?Currently, in one of my application Urlreferrer is working in my local machine but its not working when went live?Additionally, its most appreciable if anyone can guide any alternative of both Urlreferrer and HTTP_REFERRER?

View 1 Replies

Web Forms :: Request.ServerVariables["REMOTE_USER"] Not Working?

Jan 6, 2011

I am developing an internal application in .NET which tracks computer name and give access only if they match users which are in a users table in database. When i tested in my local machine and in production server, I am able to get computer name. But for few users the application just don't work since Request.ServerVariables["REMOTE_USER"] is returning empty values. For myself and even for few users we can get computer name with Request.ServerVariables["REMOTE_USER"] but for few users it returns empty values.I even tried using Request.ServerVariables["LOGON_USER"] and WindowsIdentity funtions, but still getting empty values.

View 3 Replies

MVC :: Obtain Url Query String During Json Request?

Sep 16, 2010

So I'm writing an MVC application, and have a JsonResult post back to obtain some item information for scanned items on a warehouse application I am writing. I'm trying to obtain a URL query string value though, and cannot seem to obtain one via the normal 'Request.QueryString['variable']' way... Is there a way to do this? I also thought about just passing the parameter into my post, but I already have a single value on my jquery post, and I am unsure if I can tack on more values to this.

View 7 Replies

Security :: Request.ServerVariables["LOGON_USER"] Not Returning Any Value In IIS7

Mar 25, 2010

when i was working with IIS 6.0 and windows 2003 Request.ServerVariables["LOGON_USER"] is giving me the current logged in user id,

but now we have upgraded to IIS 7 and Windows 2008 if i use the same statement it is not returning me any value.

NOTE : i am using vs2005 to write my programs.

View 5 Replies

FormsAuthentication: Whats The Difference Between Request.ServerVariables("AUTH_USER") And User.Identity.Name

Mar 29, 2011

I have a feeling that Request.ServerVariables("AUTH_USER") and User.Identity.Name return the same string while using FormsAuthentication.So my question is as simple as that. Which one should i better use?

View 1 Replies

Get The Value From Request.ServerVariables("LOGON_USER") When The Application Is Running In IIS?

Feb 13, 2011

I'm not using any built in authentication mechanism, just building a simple intranet site that requires logon.BUT i was asked to retrieve the current windows logon name of the user, and authenticate him with this information.When reading the Request.ServerVariables("LOGON_USER") information from my box, everything runs fine. But this value is always blank when the application is running with IIS on my server.

View 1 Replies

Cross-thread Operation Not Valid: Accessed From A Thread Other Than The Thread It Was Created On

Apr 2, 2010

I want to remove checked items from checklistbox (winform control) in class file method which i am calling asynchronously using deletegate. but it showing me this error message:-

Cross-thread operation not valid: Control 'checkedListBox1' accessed from a thread other than the thread it was created on.

i have tried invoke required but again got the same error. Sample code is below:

[code]....

View 1 Replies

Web Forms :: Using Server.Execute Mething With In A Thread Getting Error - Error Executing Child Request

Mar 27, 2010

I want to execute a page with server.execute method with different query string values to the page and write the response to a file. It is working perfect with out threads. whereas, if i am using threads then i am getting "Error executing child request" and some times "Object reference not set to an instance of an object." error. Below is sample code. This is working fime with out threads..if i am using thread only one request is getting executed and all others are giving error.

[code]....

View 7 Replies

Web Forms :: Use Thread.sleep Method For A Particular Thread?

Aug 27, 2010

I want a example of multithreading .i want to use it in a web form not on console.i am using C#.net .and how to use thread.sleep method for a particular thread.

View 5 Replies

Visual Studio :: Debug A Multi Thread Program To See Local Variables Of Each Thread Using 2008

Jan 27, 2010

How can we debbug a multi-thread program to see local variables of each thread using visual studio 2008.

View 1 Replies

Architecture :: How Can Thread Update A Variable Shared With The Main Thread

Nov 24, 2010

I'm new to threading and have used it successfully, but limited. I can spawn a thread and have the main thread reference variables in the spawned thread, but I don't know how to allow the spawned thread to reference (and update) variables in the main thread.

Any example threading code I've seen on the web appears to be WAY more complicated than what I do, so I am unable to understand or integrate into my code.

Here is a quick example of how I use threading:

[code].....

View 3 Replies

What Are The Differences Between Currently Executing .NET Thread And Win32 Thread

Mar 24, 2010

I am reading the Asp.net security documentation on msdn.I come across these tow terms and get really confused.

# WindowsIdentity = WindowsIdentity.GetCurrent()

which returns the identity of the security context of the currently executing Win32 thread.

# Thread = Thread.CurrentPrincipal

which returns the principal of the currently executing .NET thread which rides on top of the Win32 thread.

View 1 Replies

C# - Lock Thread.sleep Not Working With .NET Thread?

Jun 25, 2010

I have a password page and when someone enters an incorrect password I want to simply foil a brute force attack by having

bool isGoodPassword = (password == expected_password);

lock (this)
{
if (!isGoodPassword)
Thread.Sleep(2000);
}
I would expect that this would allow all correct passwords without stalling, but if one user enters a bad password another successful password from a different user would also be blocked. However, the lock doesn't seem to lock across ASP.NET threads.

View 4 Replies

Can Change Values Of ServerVariables

Feb 8, 2010

I want to change tha value of Request.ServerVariables["Remote_Addr"],is it Possible? if yes than how can we change? if No than why we can not change?

View 1 Replies

Web Forms :: Obtain DropDownList Value Before And After Being Changed

Jul 1, 2010

What is the best way to get the value of a dropdownlist control before it has been changed and after it has been changed. Can it be done in one routine? In other words, if a user clicks on a dropdownlist control and changes it's value, I need to get the old value and the new value and send both these values as input parameters to a stored proc.

View 3 Replies

Web Forms :: How To Obtain The URL Shown In The Addressbar For A Subdomain In ASP

Jan 24, 2011

My website [URL]The actual path for es.argyletv.com is argyletv.com/es/. You can access the same files for that website by typing in essentially 2 different addresses, which is bad for search engine optimization. For instance, es.argyletv.com/entry.aspx yields the same result as es.argyletv.com/es/entry.aspx.

I am trying to determine when the subdomain directory is included in the url, so that I can remove it and redirect the user to the url without the directory via a 301 redirect. The problem that I have is that:Request.Url.ToString();[URL]I've also tried to use Request.RawUrl.ToString(); and pretty much every type of output in the request class to no avail. What I need, is to be able to determine what is being shown in the address bar, so that I can direct the user to the correct URL if need be.

View 1 Replies

Web Forms :: How To Obtain The Control Which Launched The Event

Mar 30, 2010

I create dynamically a serie of buttons, with differents IDs (button_1, button_2...), but all of them, call to the same method when they "OnClientClick" event is lanched.

I need to know which of these buttons was clicked.

View 5 Replies

Web Forms :: Obtain Content From Dynamically Created Textbox?

Nov 6, 2010

I am trying to create a comment system in which the comments will be displayed and will have one level of reply to the comment.

I now have text boxes and buttons dynamically created under each comment for users to submit replies to each individual comment.

I am having difficulty obtaining the contents entered by the user within the text boxes.

[Code]....

The GetComment method is called at pageload. I am able to obtain the Id of the comments that the reply corresponds to, but not able to obtain contents entered by user in the reply text boxes, they show up as blank.

View 8 Replies

Forms Data Controls :: How To Set Datalist Items And Obtain Value In Page Behind

Jul 22, 2010

i want to use a Datalist to list products from sqldatasource. When i select the Product i would like to retrieve the associate Product value in the code behind page so that i may use it to display data in Grid.

View 8 Replies

Forms Data Controls :: Obtain A Column From A Gridview And Use It In Calculations?

Jun 3, 2010

I have a gridview with the following columns: months, number of injury, expenses. my month column is a string, my number of injury column is a number and my expenses column is a number. I need to first obtain the month column as an integer and then obtain the number of injury column in my gridview. Once these columns are obtained, I want to be able to get the total number of injuries. How do I solve the problem. First obtain the month column and change it to an interger or gridview

Next obtain the injury column and then add each row in the injury column to get the total number of injuries.

View 9 Replies

Forms Data Controls :: Obtain The Average Price From A Particular State?

Feb 18, 2011

I have a table that includes a state column and a price column.

I am able to obtain the average price from a particular state using:

SELECT avg(Price)
FROM MainTable
WHERE StateId=x

I would like to display the average price from each state. The only way I know of doing this is 50 seperate datasource controls. Is there another way?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved