State Management :: Using Server.mapPath After Application_End
Jan 13, 2011
in my Global.asax I have a timer and every 24 hours it creates an instance of a class and calls a method to send reminder emails with an attachment. In this method I am getting the current HttpContext and using Server.MapPath to get the path to the attachment, but it is always null. I guess this is because Application_End has been called between the last user accessing the site and the method being called.
As a workaround I am setting the timer interval to 19 minutes but I would rather not call the method 36 times a day when only once is required.
Is there any way, apart from hard coding the path, to ensure the HttpContext is not null?
View 5 Replies
Similar Messages:
Sep 23, 2010
What is the difference between those two? If I only want to retrieve the absoluate path to an image on web server, is Server.MapPath safer in any case? I'm using Page.MapPath right now, but it won't work if control was created in WebService since control.Page property become null? Whether Server.MapPath always work?
View 1 Replies
Aug 26, 2010
In my web application, I set the mode of session state as State Server and point to another server. After run some days, I always meet following exception:
The state server has closed an expired TCP/IP connection. The IP address of the client is 192.168.80.157. The expired Read operation began at 08/25/2010 14:18:03.
View 2 Replies
Feb 25, 2011
when we go for client and server side state management in asp.net
View 2 Replies
Sep 8, 2010
Why Session_OnEnd does not fire in state server & SQL Server modes....... i mean what is the speciality in InProc mode that Session_OnEnd fires in that mode only ????
View 1 Replies
Nov 5, 2010
Customer were getting "View State Validation Error" due to worker process recycling at our production webserver and to fix that i applied machinekey and then move my Session state Mode from In Proc to State Server to retain session data and not kick out the customer to relogin. I had serialization issue with one object which has to be stored in session but when i moved it out of session i could able to resolve the issue.
But doing all these i was partly successfull in keeping the user in their session when Worker Process recycle event occurs.I was able to refresh the page or make a post back by clicking the refresh button and also able to retain the session values. But the Problem occurs when sending asynchronous request to server which we do periodically every 15 minutes from the moment the user logs in.The web page doesnot update data on website when sending asynchronous request.By Debugging I found at this particular code point it fails to make a postback which is required.
<%=GetHintFromServer%> (When there is no Worker Process recycle i t gets replaced by
WebForm_DoCallback('__Page',message,ShowHint,null,null,false) on postback) Everything works fine when there is no Worker Process Recyling but when it happens looks like sending request asynchronously using javascript fails .Remember When I make a post back by manually clicking submit button everything works fine.
SendRequest(Asynchronous)
function SendRequest(msg, isBusy, chartMsg, vesselMsg)
{
try
{
//confirm("msg"+msg+"isBusy"+isBusy+"chartMsg"+chartMsg+"VesselMsg"+vesselMsg);
_busy = isBusy;
if(chartMsg != null)
{
//confirm("chartMsg"+chartMsg);
_element.SetMessage(true, chartMsg);
}
if(vesselMsg != null)
{
confirm("chartMsg"+vesselMsg);
_element.ShowVesselLoading(true, vesselMsg);
}
_stuckWatchdog = setTimeout( "ClearPendingRequest();", 60000);
var message = msg;
var context = '';
<%=GetHintFromServer%>
}
catch(e)
{
alert( "Exception error on SendRequest(): " + e);
}
}
View 2 Replies
Apr 5, 2010
Our ASP.NET App uses ASP State Session Management and has been rebuilt about 2 years ago [With .NET Framework 2.0]. We are currently in .NET framework 3.5 and have moved to SQL Server 2008 - but continue to use the same ASPState database. The State database has been upgraded to SQL Server 2008. Since then we have are seeing timouts/locks on ASPStateTempSessions table. I am wondering if we have to rebuild this database from scratch with some newer scripts?
View 2 Replies
Oct 27, 2010
The fix for this error message is to run [Code]..... I have run that uptown, downtown and in my lady's chamber and it does no good, although it never complains. Are there any other possibilities?Details:
IIS Server: v5.1 running on XP. SQLServer 2005 running on a different XP box.Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618 There is an ASPState database on the server, containing only two tables: [Code].... and [Code]..... I did not use [Code].... when I ran [Code]....
.
View 2 Replies
Nov 3, 2010
We recently migrated a web app from one Prod server (Prod 1) to another server (Prod 2). There is a session varialbe checked inside the page load event of the default master page. I have enabled session state both in web.config as well inside the pagedirective. The compilation went through without any issue. The web app is also running just fine on the server but the log file keeps logging a warning message. There is no run time error.
"System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration><system.web><httpModules> section in the application configuration."Any idea why this is happening on one server vs other?
View 3 Replies
Sep 30, 2010
Does anyone knows why HttpContext.Current.Server.MapPath within a server control works when I run the server control but gives and error whilst in Design mode?
View 2 Replies
Mar 22, 2011
Why Session_End event occurs only in "InProc" mode not in "State Server" and "Sql Server"?
View 7 Replies
May 4, 2010
I am developing a asp.net 3.5 web site. Cookie is used to store username when site user logins in the site.This works well on my local computer when I'm debugging it with Visual Studio.But when I publish the site and upload it to the server, cookie could not store username.
My code is as below:
//Write COOKIES
HttpCookie loginState = new HttpCookie("loginState",email);
Response.Cookies.Add(loginState);[code]....
View 8 Replies
Dec 22, 2010
I have a website of online games and I try to count and show the number of the uniqe visitor per game page, by using Cookies only. (if someone visit after 24hr it will be uniqe visitor too)
the problems is:sometimes (I don't know why), not always, it's update the counter colomn of the game, +2 instead +1, and I don't know why, there isn't any "for loop" etc.. maybe is't because the url rewrite? but it work fine if people enter again the colomn will not update again, the problem is that is update +2 instead +1 (see the code at the bottom)this is my algorithm (something is wrong in this algorithm so don't use it):
1. put the query string in variable (the name of the game) - i'm using url rewite.
2. use this variable for select the game Name (and another information) from the database (and for the cookie I will use the game name from the database and not from the query string to avoid from capital letter problems, because cappital letter for the first word isn't good because words like of, to etc..).
3. for each pageload (there isn't postback in the game page) check if the cookie of the uniqe game exists
4. if not exists, create a cookie for the unique game (the name of the cookie and the his value will be same, because I don't care about it, it's only for check if the cookie exist, and I can't use one cookie for all the games because each time visitor enter the cookie will create for 1 day).
4. after this creation of the cookie try to find if the cookie exist (for cheaking if the user didn't disable the option for cookies)
5. if yes update the database column of the spesific game
the code:
In the end of the page_load - (the GameName is the virable of the name of the game from the database and not from the qury string).
[Code]....
and the update function
[Code]....
View 4 Replies
Sep 9, 2010
High level description is this: I have a value that is pulled from a session variable. In the PageLoad method, the value is stored in a local variable. A literal control is set on the page with that local variable and then the value is stored in the database. There is no default value for the literal control on the aspx page. For some reason, the literal is displaying an incorrect value, but the value placed in the database (using the same local variable) is correct.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test 1</title>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function () {
$('#txtScore').val("3");
$('#pic1').click(function () {
[code]...
View 2 Replies
Aug 10, 2010
I have found this question in interview questions
"If i store cache in server the server will over load because of cache objects so how can i prevent that?"
View 1 Replies
May 27, 2010
i want to know if i want to use multiple server for my application. what should i do.e.g. if i used session to store some important data so as session get stored on server if my application use one server and server get crashed then my application also get crashed. So to avoid this problem what should i do (if solution is use multiple servers then how can i do that)
View 2 Replies
Apr 15, 2010
Share session using server
View 3 Replies
Jan 6, 2011
I have an ASP.NET application running on IIS6 on a Windows 7 machine. I also have a SQL2008 R2 with Reporting Service.
My site is purely internal, so to make the life of the users easier I discarded a logon page by using Windows Authentication in IIS and validating the username on my default page.
I configured the Reporting Services using the Reporting Services Configuration Manager, using Network Services, and I can follow both the Web Service URL as well as the Report Manager URL just fine, all is happy. Untill... I try to load a report.
I have an aspx page with a Reportviewer control that just blatantly refuses to display the report. I know I have the report server and report path correct because I am able to manipulate and set report parameters dynamically. However, instead of the report displaying, I get a lovely message "A network related or instance specific error occurred while establishing a connection to SQL Server. The server was not found or was not accesible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error 25 - Connection String is not valid) Now, I looked up the error and everything is set up as it should be. My NT AUTHORITYNETWORK SERVICES users has all the privileges it needs, my server allows remote connections, TCP and named pipes are enabled...
View 3 Replies
Sep 17, 2010
We are building a asp.net application in VS2010 and .Net4 environment. One of the critical requirement is performance. In most of my screen, there are few dropdown and Menus which are common and they are retrived from database (Oracle). The value in the dropdown or the menu does not change very often. We are thinking of caching the values so that it will be faster.We are thinking of using Sql Server CE4 to store the cache. I read through the below article of Scott and he says that SQL Server CE4 supports asp.net application. http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx#7590823if this is a good approach. I want to avoid storing XML files in the web server as reading and writting XML from disk involves IO operation which is a costlier operation. There is another option of storing data in application cache. But number of users are large as well as the caching data is likely to grow. So storing in application chace may have an impact on the web server's memory. So I am thinking of using SQL Server CE4.
View 1 Replies
Feb 4, 2010
where they have used SQL server state management on a 3 tiered architectuere ?How should one implement (SQL server state management) without bypassing the middlelayer.
View 1 Replies
Mar 2, 2011
I'm having a bit of trouble loading an XML file with ASP. This is the location of the XML file (it's a UNC url):
\ilife104 eamdiskSharedIntegrationSystemdevDataprcImportFactSetFeedsfileList.xml
And this is my code:
<%
'load the XML file..
Option Explicit
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("\ilife104 eamdiskSharedIntegrationSystemdevDataprcImportFactSetFeedsfileList.xml"))
Dim name, retrieved
name = xml.documentElement.childNodes(0).text
retrieved = xml.documentElement.childNodes(2).text
Set xml = Nothing
%>
It gives the error:
Server.MapPath() error 'ASP 0174 : 80004005'
Invalid Path Character(s)
/ITWeb/Interfaces/je/index.asp, line 9
An invalid '/' or '' was found in the Path parameter for the MapPath method.
View 1 Replies
Jun 3, 2010
get the list of all sessionid which will be running onto server without storing them anywhere.
View 7 Replies
Sep 14, 2010
I want to redirect from one aspx page to another aspx page of different application.Both applications are hosted in different application servers. I want to pass a value from one application to another.I tried - 1. Response.redirect with Query string - But query string is not secure as it is visible to user in browser.2. Cookies - This is also not a secure way. Again if the cookies are disable in the browser it may not work.3. Server.transfer - In different web application we cant use server.transfer.Please provide any easy solution how to achieve this. I dont want to display the values to the user as it is confidential data.
View 13 Replies
Jul 21, 2010
I have my Web site set up to use SQL Server session state. This works fine. When a session starts, a row is created in ASPStateTempSessions.
When the user logs off the application, I am trying to call the stored procedure TempRemoveStateItem to clean up after myself (not sure if this is the right way to do it or not).
What I noticed is that the SQL table's SessionID column contains 32 characters whereas the .NET Session.SessionID value only contains 24 characters (which match the first 24 characters of the 32 characters stored in the SQL table). Because the values do not match, the stored procedure always fails.
Why would the SessionID value differ between .NET and SQL?
View 7 Replies
Mar 9, 2011
I've exhausted my resources and still have been unable to determine why I'm experiencing this issue:
- I have an ASP/VB Website
- I've added a Global.asax file
- In the Global.asax file, I'm initializing some settings in the Session_Start method
If I use the Built-In VS web server, the Session_Start method is hit and the settings are initialized
If I use an IIS Virtual Directory for the website, the Session_Start method is NOT hit
View 1 Replies