473,769 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to transfer a request to a different page in IHttpModule (isapi like) class

Hi,
I'm using IHttpModule class (added to GAC and machine.config) to get
requests of non existing pages in my web server and redirect them to
different pages, using the Context.Server. Transfer(Target ) method.

i.e :
Original ==> http://myserver/notExist/HelloThere
to
Target ==> http://myserver/DoesExist/helloWorld.aspx

the problem is that the DoesExist application receive the request and
it's web.config shows the following error:

Configuration error:
"Parser Error Message: It is an error to use a section registered as
allowDefinition ='MachineToAppl ication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."

because notExist is not an appliaction in the web server, what should i
do to eliminate this problem?

Thanks!

Daberelay.

Nov 19 '05 #1
8 1655
<da*******@gmai l.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi,
I'm using IHttpModule class (added to GAC and machine.config) to get
requests of non existing pages in my web server and redirect them to
different pages, using the Context.Server. Transfer(Target ) method.

i.e :
Original ==> http://myserver/notExist/HelloThere
to
Target ==> http://myserver/DoesExist/helloWorld.aspx

the problem is that the DoesExist application receive the request and
it's web.config shows the following error:

Configuration error:
"Parser Error Message: It is an error to use a section registered as
allowDefinition ='MachineToAppl ication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."

because notExist is not an appliaction in the web server, what should i
do to eliminate this problem?


Have you tried using Response.Redire ct instead of Server.Transfer ?
Server.Transfer is really meant to transfer from one HttpHandler to another,
and in your case, it seems that the handler doesn't exist (since the page
does not exist).

John Saunders
Nov 19 '05 #2
vbpj.com had a neat article on this about a year and half or two years ago.
Do a search on their site for "hierarchic al url". It shows how to set up an
URL like:

mysite.com/dec/2004/28

to

mysite.com/pagehandler.asp x?id=12/28/2004

This is similar to what you want. And, there is sample code to download on
the site, if I remember correctly.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"da*******@gmai l.com" wrote:
Hi,
I'm using IHttpModule class (added to GAC and machine.config) to get
requests of non existing pages in my web server and redirect them to
different pages, using the Context.Server. Transfer(Target ) method.

i.e :
Original ==> http://myserver/notExist/HelloThere
to
Target ==> http://myserver/DoesExist/helloWorld.aspx

the problem is that the DoesExist application receive the request and
it's web.config shows the following error:

Configuration error:
"Parser Error Message: It is an error to use a section registered as
allowDefinition ='MachineToAppl ication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS."

because notExist is not an appliaction in the web server, what should i
do to eliminate this problem?

Thanks!

Daberelay.

Nov 19 '05 #3
hey,
Thanks for the idea but Redirect causes a back and forth trip to the
client and also changes the url in the browser's address bar, what i
would like to do is cause the server to transfer without having to tell
the client about it.

any more ideas ?

Nov 19 '05 #4
Hey there,
Thanks for the lead but it is suggesting using a workarround for asp
instead of ihttpmodule, and moreover it offers using the redirect
function instead of the server.transfer function. it's of no use to me
as i would like to change the response output without going to the
client machine.

DaberElay.

Nov 19 '05 #5
<da*******@gmai l.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
hey,
Thanks for the idea but Redirect causes a back and forth trip to the
client and also changes the url in the browser's address bar, what i
would like to do is cause the server to transfer without having to tell
the client about it.

any more ideas ?


One idea is that you _try_ redirect and see if it works. If it works, that
will tell you that the problem has to do with a difference between redirect
and Server.Transfer . If it doesn't work, that will tell you that the problem
has nothing to do with the difference between redirection and
Server.Transfer .

My concern is that there is nothing to transfer _from_ yet. In your code,
before your Server.Transfer , what kind of object is referenced by
Context.Handler ?

John Saunders
Nov 19 '05 #6
<da*******@gmai l.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hey there,
Thanks for the lead but it is suggesting using a workarround for asp
instead of ihttpmodule, and moreover it offers using the redirect
function instead of the server.transfer function. it's of no use to me
as i would like to change the response output without going to the
client machine.


I was not offering it as a workaround. I was offering it as a diagnostic
technique.

John Saunders
Nov 19 '05 #7
Sorry John,
I think there was a confusion here, the workarround line i wrote was
reffering another answer i got from George a. beamer...

as per your answer, i know redirect works (and anyhows i did it again
just to verify), because redirect doesn't touch the source of the
problem. redirect asks the client's browser to change it's request and
send it again...
the transfer function trys to do it without ever leaving the server
side.

as for the Context.Handler , its <undefined value> ( i.e. null reference
), what can we understand from this ? is there something i need to
instanciate first ?
Your concern is correct, there is nothing to transfer from just yet,
simply because the original request was for a page that doesn't exist.
Thanks for the responsiveness!

DaberElay.

Nov 19 '05 #8
<da*******@gmai l.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Sorry John,
I think there was a confusion here, the workarround line i wrote was
reffering another answer i got from George a. beamer...

as per your answer, i know redirect works (and anyhows i did it again
just to verify), because redirect doesn't touch the source of the
problem. redirect asks the client's browser to change it's request and
send it again...
the transfer function trys to do it without ever leaving the server
side.

as for the Context.Handler , its <undefined value> ( i.e. null reference
), what can we understand from this ? is there something i need to
instanciate first ?
Your concern is correct, there is nothing to transfer from just yet,
simply because the original request was for a page that doesn't exist.
Thanks for the responsiveness!


I no longer recall the details of the original problem, but I know became
concerned because I suspected that Context.Handler would be null. I'm
frankly surprised that Server.Transfer works at all.

Have you looked into Url Rewriting using Context.Rewrite Path? I have used it
successfully in a similar situation.

John Saunders
Nov 19 '05 #9

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

Similar topics

5
2649
by: Jon Sequeira | last post by:
Is there a way to redirect from an ASP.NET page to an ASP page without showing the ASP page's URL in the client's browser? This works perfectly with an HTML page, for example: path = "~/cp/test.htm" Server.Transfer(path, False) But with an .asp extension, the I get an HttpException, "Error executing child request for ~/cp/test.asp."
2
2022
by: ndario | last post by:
i am trying to transfer a user to another page with Server.Transfer() but i am having a problem with sending query params like this Server.Transfer("newPage.aspx?param=value"); in the PageLoad method of the newPage.aspx.cs, Request.QueryString is allways null. is there any way to transfer to another page, but to recive a param on the another page. i even try with response.redirect, but it doesn't help. also, puting value in the...
2
2377
by: Kenneth Myhra | last post by:
Hi, We have been trying to develop an IHTTPModule (that was supposed to replace or take over the ISAPI Filters, as far as we know). We have developed one in C# and it seems to be working. The problem is that it is not working as it is supposed to work and we *need* to debug it. We made a search on MSDN already. Either my search keywords were irrelevant (we used <IHTTPModule debug> and <IHTTPModule debugging>, without the greater and...
1
3495
by: Victor Song | last post by:
Hi We are trying to stream a file using server.transfer rather than response.redirect. We have it working for IIS 5.0 but IIS 6.0 refusing to let us transfer the file. If we do the less efficient prompt/response technique to the browser both work fine. We found this article that was only slightly appicable (ms-help://MS.MSDNQTR.2004APR.1033/enu_kbiis/iis/326965.ht kb 326965 ) but since csv is already a defined mime type this shouldn't...
8
3901
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the Transfer method, but everything gets me the same error 500. Any help would be appreciated.
5
2184
by: Richard | last post by:
I've developed a small ASPX template framework (based on Chun Li's article on CodeProject: http://www.codeproject.com/aspnet/headerfooter.asp#xx849313xx) which uses a IHttpModule to apply usercontrols (e.g. header and footer) on pages. The module determines if templates should be added to the page using Page.Request.Path. It matches the current adress to settings found in a configuration-file... It works like a charm except for one...
3
2558
by: Joseph S. | last post by:
Is there a system available to do the following: consider an app of a few pages: page1.php: form1----->page3.php form2----->page4.php page2.php: form3----->page3.php form4----->page4.php
1
2465
by: omantawy | last post by:
Hi, I have some legacy ASP web applications that use an unmanaged COM component to connect to a third party application. The third part application has moved to the managed code in the current release with backward compatibility with the unmanaged code. In the future releases, the vendor is going to drop backward compatibility and as a result of that all our legacy ASP applications will break.
12
2152
by: Mark Rae | last post by:
Hi, See the previous thread Request.Form abuse in this newsgroup... I'm looking for a simple and efficient way to prevent people hijacking the <formtags on my websites and using them to send spam. I would imagine they're using the HttpWebRequest method for this. Essentially, it would require a property on a WebForm that indicates whether it is *only* for PostBack (true by default, but configurable), which would
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
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...
1
9990
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,...
1
7406
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
6672
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
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
3
2814
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.