473,563 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Employ eeKey")
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("Employ eeKey")

m_sink = sink

fs = New FileStream("D:\ Program
Files\MEBIM\\Ad dendum" & strEmployeeKey & ".htm" ",
FileMode.OpenOr Create, FileAccess.Writ e)

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.SetLengt h(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(buf fer, 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(bu ffer, 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(Sende r As Object, E As EventArgs)

Response.Filter = New ResponseFilter( Response.Filter )

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

Off the top of my head its something like this:

strEmployeeKey= app.httpcontext .Current.Sessio n("EmployeeKey" )
--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"Lou" <lk********@yah oo.com> wrote in message
news:23******** *************** ***@posting.goo gle.com...
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("Employ eeKey")
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("Employ eeKey")

m_sink = sink

fs = New FileStream("D:\ Program
Files\MEBIM\\Ad dendum" & strEmployeeKey & ".htm" ",
FileMode.OpenOr Create, FileAccess.Writ e)

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.SetLengt h(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(buf fer, 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(bu ffer, 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(Sende r 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
4391
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" after the first recursion. Any ideas what can be done to make the following code work. Thanks
1
2389
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 through each day of that month and output the events for a particular day for each day without having to open up 28 to 31 different recordsets. The...
1
4739
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 I have run into I am not sure how to fix, and really not sure what is causing it. Here's what is going on (test server - Windows 2003 Server): I...
7
4128
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 is how to corelate the response to a corresponding request. I am looking for a sure proof threadsafe way to corelate a response to a coresponding...
1
3886
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 = New DirectoryEntry("LDAP://domain") Dim mySearcher As New DirectorySearcher(enTry) Dim resEnt As SearchResult mySearcher.Filter =...
1
295
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 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...
0
1574
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 stream.(Because I need a string of response) Here is my code: protected void Application_PreSendRequestContent(object sender, EventArgs e)
1
1505
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 happening when i redirect - i need to somehow end the response but not with Response.End because it doesn't allow it to get to the Redirect statement...
0
3304
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. So far I have tested my code on IIS 5.1, 6.0 and ASP.NET Development Server/9.0.0.0 all with the same result. Does anyone have any suggestions?
0
7665
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...
0
7888
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. ...
1
7642
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...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
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...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.