Your question is not clear "Is there a way I can stop people being able to call the .aspx directly". when user comes to Register page automatically validate and redirect to home page, is that correct or please give more details.
hi venkat, thanks for your quick response. Basically I don't want people to be able to open the page by calling
www.mysite.com/register.aspx. here is the rules I expect to be able to apply:
When a page is requested, a Request object is created. This Request object contains all the vital information from where it is being called. For your current situation Request.UrlReferrer properties does the job. It contains information from which url it
is being called. You can implement this in to your register.aspx page.
for e.g. if you are calling register.aspx page from www.mysite.com/registerfirstpage.aspx, the register.aspx "Request.UrlReferrer" will contain url of www.mysite.com/registerfirstpage.aspx.
Did you try using Respose.RedirectToRoute("registermembership") in the code behind of register.aspx page? It will automatically redirect user to the required URL.
thanks for your advise, in order to do Response.RedirectToRoute("regisermembership") in Page_Load method, I need to know if user is calling the register.aspx page directly. Otherwise the page will run into a deadloop withthis line...
any idea how to find out whether user is calling the regiser.aspx page directly?
Achievement provides the only real pleasure in life
ssffcc
Member
215 Points
122 Posts
disable or redirect direct call to .aspx pages when routing is implemented
Jul 29, 2012 12:33 PM|LINK
hi
I have implemented routing on my asp.net web appilcation, so that user can call something like: www.mysite.com.au/registermember
This link opens Register.aspx page. At the moment people can also open this page using: www.mysite.com.au/Register.aspx.
Is there a way I can stop people being able to call the .aspx directly? e.g. authorise people who types in www.mysite.com.au/registermember, and redirect people to homepage when people type in www.mysite.com.au/Register.aspx?
thanks in advance
venkat.mru
Member
54 Points
29 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 29, 2012 01:10 PM|LINK
Hi,
Your question is not clear "Is there a way I can stop people being able to call the .aspx directly". when user comes to Register page automatically validate and redirect to home page, is that correct or please give more details.
</div>M.Venkatesh Kumar
CPrakash82
All-Star
18722 Points
2900 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 29, 2012 01:21 PM|LINK
You can write a rule for it or can write Response.RedirectToRoute("registermember") in your code behind.
ssffcc
Member
215 Points
122 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 29, 2012 02:41 PM|LINK
hi venkat, thanks for your quick response. Basically I don't want people to be able to open the page by calling www.mysite.com/register.aspx. here is the rules I expect to be able to apply:
* if user types in www.mysite.com/registermember, --> open the page
* if user types in www.mysite.com/register.aspx --> reject page request and maybe redirect user to a "page not found" page
Already implemented rule No.1, but need to learn how to implement No.2 role.
zeyaul
Member
189 Points
33 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 29, 2012 03:23 PM|LINK
Hi there,
When a page is requested, a Request object is created. This Request object contains all the vital information from where it is being called. For your current situation Request.UrlReferrer properties does the job. It contains information from which url it is being called. You can implement this in to your register.aspx page.
for e.g. if you are calling register.aspx page from www.mysite.com/registerfirstpage.aspx, the register.aspx "Request.UrlReferrer" will contain url of www.mysite.com/registerfirstpage.aspx.
If you still have any query please let me know.
regards,
zeyaul Haque
ssffcc
Member
215 Points
122 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 30, 2012 02:39 PM|LINK
hi Zeyaul
thanks for your help, but I am not trying to call one page from another.
www.mysite.com/register.aspx is the actuaal page, www.mysite.com/registermember is the routing which opens register.aspx page.
still stuck :(
zeyaul
Member
189 Points
33 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 31, 2012 04:54 AM|LINK
it does not matter either you are calling from one page to another, it works even the link is coming from different site.
good luck.
regards,
zeyaul Haque
ssffcc
Member
215 Points
122 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 31, 2012 05:10 AM|LINK
hi zeyaul
you misunderstood my issue.
I want to stop people being able to call .aspx page directly. i.e.
If people type in www.mysite.com/register.aspx they will not be able to get onto the page, instead they can only type in the routed URL, which is www.mysite.com/registermembership
thanks for trying to help anyway, very much appreciated
CPrakash82
All-Star
18722 Points
2900 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 31, 2012 10:43 AM|LINK
Did you try using Respose.RedirectToRoute("registermembership") in the code behind of register.aspx page? It will automatically redirect user to the required URL.
ssffcc
Member
215 Points
122 Posts
Re: disable or redirect direct call to .aspx pages when routing is implemented
Jul 31, 2012 03:02 PM|LINK
hi CPrakash82
thanks for your advise, in order to do Response.RedirectToRoute("regisermembership") in Page_Load method, I need to know if user is calling the register.aspx page directly. Otherwise the page will run into a deadloop withthis line...
any idea how to find out whether user is calling the regiser.aspx page directly?