it writes content to the page, that we have done already. but we were not sure about the 302 response URL manipulation.
so I want to change the 302 URL. any example would be helpful.
Did you read the link? The link contains source code that specifically illustrates where to modify the response. Did you try writing code? Can you share what you tried? Anything?
Again, your solution seems odd and it points to a general design bug. Can you explain how you got your self into this situation? Seems to me you can just do a find and replace to fix the Response.Redirect("~/default.aspx")
In your other thread I gave a link for using the url rewriting module as it seems what you want.
You don't have the source code? Explain maybe your constraints but for now it seems that for some unknown reason you are making that harder than it should.
Edit: and you also talked about Server.Transfer ??? IMO explain first which problem you are trying to solve. You want just to change the location of a single page within your app ?
if i had time to research i would not have asked here, as far as the module writing is concerned it is on internet, there is know need to ask.
if u focuse what i am asking then only we will be able to answer.
kindly read my first post.
I think if you showed the slightest effort to write code, forum member would be more willing to provide coding assistance. Frankly, stating that you do not have time to research does not help convince form members to use their precious time to write your
code. Good luck.
Note also that it means that you'll have two redirection when you could have one instead. Make sure you have a strong reason for not just fixing the source issue.
Do yo mean it is NOT working? A problem could be that Response.Redirect aborts the thread by default (causing likely this event to be stkipped) and fixing this would require anyway to change existing Response.Redirect calls.
An http handler is to process http requests in a particular way (for example ASPX pages).
It would be rather an http module as shown ealier (or the url rewriting module already mentionned). If it works already rather than spending time in a mdule I would spent my time in updating my application code (maybe adding a configurartion value if you
plan to change this later) so it works as I want to start with ;-)
It's the Global.asax not asmx. Asmx is a web service.
Either approach works. It is up to you to pick an approach that meets your application requirements. I would use a module as is seems like the approach is more of a hack for an unknown programming problem. Modules can be turned off from configuration.
If this application is deployed to an environment that does not have this issue, then the module can be turned off from configuration.
Member
16 Points
172 Posts
302 is sent back to browser when response.redirect is used. can it be manupulated
May 01, 2020 10:13 AM|rajemessage|LINK
i have seen handlers and modules can be written to hook up in the life cycle of asp.net pipeline.
so when i noticed that response.redirect(~/Default.aspx) sends back
302 found to the browser and then browser executes GET for the url http://localhost:81/Default.aspx
then I realised that it is possible to put some path to in http://localhost;81/kkk/default.aspx
by intercepting the 302 found http://localhost:81/Default.aspx and changing it to http://localhost;81/kkk/default.aspx
so that when browser calls to should call the new one.
All-Star
53041 Points
23624 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 01, 2020 12:56 PM|mgebhard|LINK
Why don't you simply add Response.Redirect(~/kkk/Default.aspx) to the Page_Load event of /Default.aspx page?
You can get into the HTTP pipeline using HTTP Modules which allows you to change the response.
https://docs.microsoft.com/en-us/previous-versions/ms227673(v=vs.140)?redirectedfrom=MSDN
I you explain why you have this problem then the community might be able to provide an alternative solution.
Member
16 Points
172 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 02, 2020 08:29 AM|rajemessage|LINK
it writes content to the page, that we have done already. but we were not sure about the 302 response URL manipulation.
so I want to change the 302 URL. any example would be helpful.
All-Star
53041 Points
23624 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 02, 2020 10:31 AM|mgebhard|LINK
Did you read the link? The link contains source code that specifically illustrates where to modify the response. Did you try writing code? Can you share what you tried? Anything?
Again, your solution seems odd and it points to a general design bug. Can you explain how you got your self into this situation? Seems to me you can just do a find and replace to fix the Response.Redirect("~/default.aspx")
All-Star
48530 Points
18075 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 02, 2020 10:42 AM|PatriceSc|LINK
Hi,
In your other thread I gave a link for using the url rewriting module as it seems what you want.
You don't have the source code? Explain maybe your constraints but for now it seems that for some unknown reason you are making that harder than it should.
Edit: and you also talked about Server.Transfer ??? IMO explain first which problem you are trying to solve. You want just to change the location of a single page within your app ?
Member
16 Points
172 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 02, 2020 12:09 PM|rajemessage|LINK
if i had time to research i would not have asked here, as far as the module writing is concerned it is on internet, there is know need to ask.
if u focuse what i am asking then only we will be able to answer.
kindly read my first post.
All-Star
53041 Points
23624 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 02, 2020 01:05 PM|mgebhard|LINK
I think if you showed the slightest effort to write code, forum member would be more willing to provide coding assistance. Frankly, stating that you do not have time to research does not help convince form members to use their precious time to write your code. Good luck.
All-Star
53041 Points
23624 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 02, 2020 02:34 PM|mgebhard|LINK
Code copied and slightly modified from the link provided openly above; https://docs.microsoft.com/en-us/previous-versions/ms227673(v=vs.140)?redirectedfrom=MSDN
All-Star
48530 Points
18075 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 03, 2020 11:29 AM|PatriceSc|LINK
Or in the other thread I posted a link https://www.jondjones.com/architecture/continuous-intergration/iis/ultimate-guide-to-creating-url-rewrite-rules-within-iis/ the first example showing how to use the url rewriting module. It's best to avoid posting the same question multiple times which makes things harder to follow.
Note also that it means that you'll have two redirection when you could have one instead. Make sure you have a strong reason for not just fixing the source issue.
Member
16 Points
172 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 05:06 AM|rajemessage|LINK
this was working, but i noticed that by justputting
following in global.asax it was wokring so is it required to make an handeler?
All-Star
48530 Points
18075 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 07:17 AM|PatriceSc|LINK
Do yo mean it is NOT working? A problem could be that Response.Redirect aborts the thread by default (causing likely this event to be stkipped) and fixing this would require anyway to change existing Response.Redirect calls.
Member
16 Points
172 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 08:48 AM|rajemessage|LINK
it is working, thank you very much.
but I have not made handler, instead, I added the event in global.asmx.
and it is working. so my question is, what I did is correct or should I make a handler?
All-Star
48530 Points
18075 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 09:57 AM|PatriceSc|LINK
An http handler is to process http requests in a particular way (for example ASPX pages).
It would be rather an http module as shown ealier (or the url rewriting module already mentionned). If it works already rather than spending time in a mdule I would spent my time in updating my application code (maybe adding a configurartion value if you plan to change this later) so it works as I want to start with ;-)
All-Star
53041 Points
23624 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 10:33 AM|mgebhard|LINK
Please read your original post. You asked for an HTTP Handler or Module.
The Global.asax also works.
Member
16 Points
172 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 11:45 AM|rajemessage|LINK
I wrote handler word in a general way, u should pick up from context. what we were talking about.
by the way if u should see what was given to me WebFormsDemo.HttpModulesHandelers.CustomRedirectModule
but u should stick to the first line.
and my question is not answered, should I use global.asmx or should I write a module the way u have written.
All-Star
53041 Points
23624 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 12:16 PM|mgebhard|LINK
It's the Global.asax not asmx. Asmx is a web service.
Either approach works. It is up to you to pick an approach that meets your application requirements. I would use a module as is seems like the approach is more of a hack for an unknown programming problem. Modules can be turned off from configuration. If this application is deployed to an environment that does not have this issue, then the module can be turned off from configuration.
Member
16 Points
172 Posts
Re: 302 is sent back to browser when response.redirect is used. can it be manupulated
May 05, 2020 01:19 PM|rajemessage|LINK
yes, it is .asax, ok thank u