473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with Response Filter Class

Lou
I'm using the Response Filter Class in MS KB article 811162
(http://support.microsoft.com/default...b;EN-US;811162) to
generate a static htm page from an asp.net template page being filled
from a database. The generated static pages are then streamed into
FreeTextbox editor for user edits.

I want to use a variable for the filename since each user will need a
separate temporary template page.

The system works fine for a hardcoded filename like addendum.htm but
yields the following error when I try to use a variable as the
filename.

How can I solve this?

Thanks for your help,
Lou

--------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30469: Reference to a non-shared member
requires an object reference.

Source Error:

Line 17:
Line 18: Dim strEmployeeKey as string
Line 19: strEmployeeKey=Session("EmployeeKey")
Line 20:
Line 21:
************************

Public Class ResponseFilter

Inherits Stream

Dim fs As FileStream

Dim m_sink As Stream

Dim m_position As Long
Sub New(ByVal sink As Stream)
Dim strEmployeeKey as string
strEmployeeKey=Session("EmployeeKey")

m_sink = sink

fs = New FileStream("D:\Program
Files\MEBIM\\Addendum" & strEmployeeKey & ".htm" ",
FileMode.OpenOrCreate, FileAccess.Write)

End Sub

Public Overrides ReadOnly Property CanRead() As
Boolean

Get

Return True

End Get

End Property

Public Overrides ReadOnly Property CanSeek() As
Boolean

Get

Return False

End Get

End Property

Public Overrides ReadOnly Property CanWrite() As
Boolean

Get

Return False

End Get

End Property

Public Overrides ReadOnly Property Length() As Long

Get

Return 0

End Get

End Property

Public Overrides Property Position() As Long

Get

Return m_position

End Get

Set(ByVal Value As Long)

m_position = Value

End Set

End Property

Public Overrides Function Seek(ByVal offset As Long,
ByVal direction As SeekOrigin) As Long

Return 0

End Function

Public Overrides Sub SetLength(ByVal length As Long)

m_sink.SetLength(length)

End Sub

Public Overrides Sub Close()

m_sink.Close()

fs.Close()

End Sub

Public Overrides Sub Flush()

m_sink.Flush()

End Sub

Public Overrides Function Read(ByVal buffer() As Byte,
ByVal offset As Int32, ByVal count As Int32) As Int32

Return m_sink.Read(buffer, offset, count)

End Function

Public Overrides Sub Write(ByVal buffer() As Byte,
ByVal offset As Int32, ByVal count As Int32)

' Write out the response to the browser.

m_sink.Write(buffer, 0, count)

m_sink.close

' Write out the response to the file.

fs.Write(buffer, 0, count)

' fs.close

End Sub

End Class

Sub Page_Init(Sender As Object, E As EventArgs)

Response.Filter = New ResponseFilter(Response.Filter)

End Sub
Jul 21 '05 #1
1 2442
you need to refer to the applications httpcontext current session

Off the top of my head its something like this:

strEmployeeKey=app.httpcontext.Current.Session("Em ployeeKey")
--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Lou" <lk********@yahoo.com> wrote in message
news:23**************************@posting.google.c om...
I'm using the Response Filter Class in MS KB article 811162
(http://support.microsoft.com/default...b;EN-US;811162) to
generate a static htm page from an asp.net template page being filled
from a database. The generated static pages are then streamed into
FreeTextbox editor for user edits.

I want to use a variable for the filename since each user will need a
separate temporary template page.

The system works fine for a hardcoded filename like addendum.htm but
yields the following error when I try to use a variable as the
filename.

How can I solve this?

Thanks for your help,
Lou

--------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: BC30469: Reference to a non-shared member
requires an object reference.

Source Error:

Line 17:
Line 18: Dim strEmployeeKey as string
Line 19: strEmployeeKey=Session("EmployeeKey")
Line 20:
Line 21:
************************

Public Class ResponseFilter

Inherits Stream

Dim fs As FileStream

Dim m_sink As Stream

Dim m_position As Long
Sub New(ByVal sink As Stream)
Dim strEmployeeKey as string
strEmployeeKey=Session("EmployeeKey")

m_sink = sink

fs = New FileStream("D:\Program
Files\MEBIM\\Addendum" & strEmployeeKey & ".htm" ",
FileMode.OpenOrCreate, FileAccess.Write)

End Sub

Public Overrides ReadOnly Property CanRead() As
Boolean

Get

Return True

End Get

End Property

Public Overrides ReadOnly Property CanSeek() As
Boolean

Get

Return False

End Get

End Property

Public Overrides ReadOnly Property CanWrite() As
Boolean

Get

Return False

End Get

End Property

Public Overrides ReadOnly Property Length() As Long

Get

Return 0

End Get

End Property

Public Overrides Property Position() As Long

Get

Return m_position

End Get

Set(ByVal Value As Long)

m_position = Value

End Set

End Property

Public Overrides Function Seek(ByVal offset As Long,
ByVal direction As SeekOrigin) As Long

Return 0

End Function

Public Overrides Sub SetLength(ByVal length As Long)

m_sink.SetLength(length)

End Sub

Public Overrides Sub Close()

m_sink.Close()

fs.Close()

End Sub

Public Overrides Sub Flush()

m_sink.Flush()

End Sub

Public Overrides Function Read(ByVal buffer() As Byte,
ByVal offset As Int32, ByVal count As Int32) As Int32

Return m_sink.Read(buffer, offset, count)

End Function

Public Overrides Sub Write(ByVal buffer() As Byte,
ByVal offset As Int32, ByVal count As Int32)

' Write out the response to the browser.

m_sink.Write(buffer, 0, count)

m_sink.close

' Write out the response to the file.

fs.Write(buffer, 0, count)

' fs.close

End Sub

End Class

Sub Page_Init(Sender As Object, E As EventArgs)

Response.Filter = New ResponseFilter(Response.Filter)

End Sub

Jul 21 '05 #2

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

Similar topics

4
by: JP SIngh | last post by:
Thanks to Manohar for writing the basic code for displaying the managers and the employees in a tree like structure. I have adapted the code below but it gives me an error "exception occcured"...
1
by: Edward Burns | last post by:
I am trying to create an events calendar with a complete month view. I want to be able to get all the events for a particular month, using only one recordset on the page then be able to loop...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
7
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
1
by: Lou | last post by:
I'm using the Response Filter Class in MS KB article 811162 (http://support.microsoft.com/default.aspx?scid=kb;EN-US;811162) to generate a static htm page from an asp.net template page being...
0
by: Salim Afsar | last post by:
Hi, I'm trying to compress all requests. When client send a request, I will compress the response and send it to client. For this purpose I get Response.Filter stream and try to read this...
1
by: ocbka1 | last post by:
i'm using creating a webpage on the fly that i save as an xls file to be attached to an email and sent dynamically. i've got a custom response filter class to write it out. the problems start...
0
by: elliott | last post by:
Hello, I'm trying to use a C# IHttpModule to install a Response filter however IIS keeps removing the Content-Encoding header from the response; but all the other headers I set stay intact. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.