473,606 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the session-object within an IHttpHandler

I've read all the items about the IHttpHandler and the session-object
and I see nothing wrong with my code, but still I have no session
object.

This is my code:
Imports System
Imports System.Data
Imports System.Web
imports System.Web.Sess ionState
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.UI.H tmlControls
Imports System.IO

Public Class Upload
Implements IHttpHandler
Implements IRequiresSessio nState

'Public Sub ProcessRequest( ByVal context As HttpContext) Implements
IHttpHandler
'Implements IRequiresSessio nState

'Public Sub ProcessRequest( ByVal context As HttpContext) Implements
System.Web.IHtt pHandler.Proces sRequest',
system.web.sess ionstate.IRequi resSessionState
Public Overridable Sub ProcessRequest( ByVal context As HttpContext)
Implements IHttpHandler.Pr ocessRequest
Dim objSession As HttpSessionStat e = context.current .Session
If context.Request .Files.Count 0 Then
Dim tempFile As String = context.Request .PhysicalApplic ationPath
Dim j As Integer = 0
While j < context.Request .Files.Count
Dim uploadFile As HttpPostedFile = context.Request .Files(j)
If uploadFile.Cont entLength 0 Then
try
Dim outputdir As string = objSession("dir ") & ""

Dim sUploadDir as string = "\\fileserver\t est2\"
if outputdir.lengt h 0 Then
uploadFile.Save As(outputdir & uploadFile.File Name)
Else
uploadFile.Save As(sUploadDir & uploadFile.File Name)
End If
catch ex as exception
Dim sOut as string = "uploaderror.lo g"

If File.Exists(sOu t) Then File.Delete (sOut)
Dim sw As StreamWriter = New StreamWriter(sO ut)
sw.WriteLine (ex.tostring)
sw.Close()
end try
End If
j += 1
End While
End If
HttpContext.Cur rent.Response.W rite(" ")
End Sub

Public Overridable ReadOnly Property IsReusable() As Boolean
Implements IHttpHandler.Is Reusable
Get
Return True
End Get
End Property
End Class

My web.config looks like:
<httpHandlers >
<remove verb="POST,GET" path="Upload.ax d"/>
<add verb="POST,GET" path="Upload.ax d" type="Upload"/>

</httpHandlers>
<httpRuntime maxRequestLengt h="1550000"/>
<sessionState mode="StateServ er"
stateConnection String="tcpip=1 27.0.0.1:42424"
cookieless="fal se"
timeout="200"/>

The start aspx looks like:
<%@ Page Language="VB" AutoEventWireup ="true" enableviewstate ="true"
AspCompat="fals e" Trace="false" Debug="true"%>

<%@ Import Namespace="Syst em.IO" %>
<%@ Import Namespace="Syst em.Data" %>
<%@Import Namespace="Syst em.Data.Common" %>
<script language="VB" runat="server">

Sub Page_Load(sende r as Object, e as EventArgs)
Session("dir")= "\\server\test1 \"
End Sub

No error appears, but all the uploaded files are uploaded in the
test2-directory, but I want them in the directory what is set in the
session-object.

I've started with IIS 5, but now I'm testing with IIS 6. But it's not
making any difference.

I'm hoping that someone can tell me what I've forgotten or what I'm
doing wrong.

Is there anybody out there, who can help me???

Dec 20 '06 #1
1 4308
The reason why I don't have my session is because of the redirecting
object is not my aspx-page but a flash object.

Dec 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3302
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals and a couple "better pratice" code. Not perfect, but better. Problem : I'm testing everything with Firefox on my machine (IIS on WinXP Pro), and everything is ok. As soon as I try MS IE 6, it doesn't seem to keep the sessions from page to...
1
4365
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to log in each time they come to the site. In a .htaccess file I set session.cookie_lifetime to 20736000 seconds and I set session.gc_maxlifetime to 20736000 It works for about 30 minutes. A user can login and then close their browser and then...
6
2380
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an email from (possibly) three seperate forms. the following code is the end of a routine which stashes data from the first form off to session variables and then redirects itself to the proper form / procedure depending upon the state of two...
0
3228
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te documentation it seems it should do it anyway any advice?
7
3963
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I got the exact same SessionID as of other users's. Well I guess nothing wrong with my code, do I need to set any property in Web.Config file??
0
2468
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains the following information: intProdID -- ProductID strProdName -- Product Name intQuant -- Quantity intProdPrice -- Price productType -- Type of product (ie. Wine, Cheese, etc...)
2
2633
by: Gordon Burditt | last post by:
I had this idea about preventing session fixation, and I'm wondering what anyone else thinks about it. The idea is, essentially, don't allow session ids that YOUR PHP didn't generate (and aren't yet expired) to log in. That way if someone sticks a made-up session ID on a URL, it won't matter, unless it happens to correspond to an active session (guessing a user password is probably easier). Is this already standard practice, new, or is...
5
2426
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
3
3108
by: mikeboston | last post by:
Hi, I am attempting to use php session variables on a server which is running Red Hat Linux, but the variables don't seem to be getting passed between pages. I have tried the same exact test script on my third party webhost, and it works just fine. Does anyone know of anything that needs to be changed in a default Red Hat php setup? This is the test script that I am using: http://php.about.com/od/advancedphp/ss/php_sessions.htm This is...
1
8958
by: KidQuin | last post by:
I am having problems with session value between pages. Happening in both firefox and IE7. I go between page by links so I know it's not header changes. I use session_start as the first line on the page creating the session and the new page. The problem just start when code was untouched. I am using PHP 4.4.7 on an Apache Server. Any help or suggestions would be welcomed here is my php.ini file ; Handler used to store/retrieve...
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8432
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8428
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8078
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3919
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.