473,608 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help!! RedirectFromLog inPage and GetRedirectUrl

Any help anyone can give me will be appreciated!!!! This is driving me
c-r-a-z-y!

All I can get from both of the above redirections is a redirect to a page
named default.aspx. How do I make either of these work? I have an app that
has two pages that need a login. I need to be able to have it automatically
return to whichever page the user came from.

I've tried both of the following (not together, of course):
[Button Submit has code to check database]
FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)

[Button Submit has code to check database]
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text, False))

My Web Config has this in it:

<authenticati on mode="Forms" >
<forms name=".LoginCoo kie" loginUrl="Login .aspx"
protection="All " timeout="40" path="/" />
</authentication>
(Although I would rather not rely on cookies since people can turn them off,
but I got this from an example in a book and couldn't find an example of how
to do it without cookies.)

I made sure in IIS the app was an app.

I originally had one of the pages in a separate folder. I thought maybe
that had something to do with it, so I cut and pasted it to the first level.
That did nothing.

Again, any suggestions will be greatly appreciated!
--
Sandy
Nov 19 '05 #1
9 3566
TJS
try this
If User.Identity.I sAuthenticated Then
[do whatever here]
Else
response.redire ct("~/login.aspx")
End If


"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:C6******** *************** ***********@mic rosoft.com...
Any help anyone can give me will be appreciated!!!! This is driving me
c-r-a-z-y!

All I can get from both of the above redirections is a redirect to a page
named default.aspx. How do I make either of these work? I have an app
that
has two pages that need a login. I need to be able to have it
automatically
return to whichever page the user came from.

I've tried both of the following (not together, of course):
[Button Submit has code to check database]
FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)

[Button Submit has code to check database]
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text,
False))

My Web Config has this in it:

<authenticati on mode="Forms" >
<forms name=".LoginCoo kie" loginUrl="Login .aspx"
protection="All " timeout="40" path="/" />
</authentication>
(Although I would rather not rely on cookies since people can turn them
off,
but I got this from an example in a book and couldn't find an example of
how
to do it without cookies.)

I made sure in IIS the app was an app.

I originally had one of the pages in a separate folder. I thought maybe
that had something to do with it, so I cut and pasted it to the first
level.
That did nothing.

Again, any suggestions will be greatly appreciated!
--
Sandy

Nov 19 '05 #2
Thanks so much for your response.

The problem is not getting to the login page. It is the redirecting back to
the original page they came from.

The RedirectFromLog inPage and GetRedirectUrl are supposed to, as a fellow
programmer put it, "automagica lly" redirect back to the page that took them
to the login page. As I understand it, from all the reading I've done, both
in books and on the Internet, he is entirely correct . . . however, for some
reason my machine seems to have a mind of its own and is not responding
correctly. (Of course, I blame it on my box, but we both know who's the
smarter of the two . . .guess I'm doing something dumb - I haven't found an
instance where anyone has had a problem with this.)

Can you give me another clue?

Again, thanks so much for your response! This is sooooo frustrating!
--
Sandy
"TJS" wrote:
try this
If User.Identity.I sAuthenticated Then
[do whatever here]
Else
response.redire ct("~/login.aspx")
End If


"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:C6******** *************** ***********@mic rosoft.com...
Any help anyone can give me will be appreciated!!!! This is driving me
c-r-a-z-y!

All I can get from both of the above redirections is a redirect to a page
named default.aspx. How do I make either of these work? I have an app
that
has two pages that need a login. I need to be able to have it
automatically
return to whichever page the user came from.

I've tried both of the following (not together, of course):
[Button Submit has code to check database]
FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)

[Button Submit has code to check database]
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text,
False))

My Web Config has this in it:

<authenticati on mode="Forms" >
<forms name=".LoginCoo kie" loginUrl="Login .aspx"
protection="All " timeout="40" path="/" />
</authentication>
(Although I would rather not rely on cookies since people can turn them
off,
but I got this from an example in a book and couldn't find an example of
how
to do it without cookies.)

I made sure in IIS the app was an app.

I originally had one of the pages in a separate folder. I thought maybe
that had something to do with it, so I cut and pasted it to the first
level.
That did nothing.

Again, any suggestions will be greatly appreciated!
--
Sandy


Nov 19 '05 #3
TJS
For what it'e worth, the redirect back to the selected page before login,
doesn't work for me either.


"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:21******** *************** ***********@mic rosoft.com...
Thanks so much for your response.

The problem is not getting to the login page. It is the redirecting back
to
the original page they came from.

The RedirectFromLog inPage and GetRedirectUrl are supposed to, as a fellow
programmer put it, "automagica lly" redirect back to the page that took
them
to the login page. As I understand it, from all the reading I've done,
both
in books and on the Internet, he is entirely correct . . . however, for
some
reason my machine seems to have a mind of its own and is not responding
correctly. (Of course, I blame it on my box, but we both know who's the
smarter of the two . . .guess I'm doing something dumb - I haven't found
an
instance where anyone has had a problem with this.)

Can you give me another clue?

Again, thanks so much for your response! This is sooooo frustrating!
--
Sandy
"TJS" wrote:
try this
If User.Identity.I sAuthenticated Then
[do whatever here]
Else
response.redire ct("~/login.aspx")
End If


"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:C6******** *************** ***********@mic rosoft.com...
> Any help anyone can give me will be appreciated!!!! This is driving me
> c-r-a-z-y!
>
> All I can get from both of the above redirections is a redirect to a
> page
> named default.aspx. How do I make either of these work? I have an app
> that
> has two pages that need a login. I need to be able to have it
> automatically
> return to whichever page the user came from.
>
> I've tried both of the following (not together, of course):
> [Button Submit has code to check database]
> FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)
>
> [Button Submit has code to check database]
> Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text,
> False))
>
> My Web Config has this in it:
>
> <authenticati on mode="Forms" >
> <forms name=".LoginCoo kie" loginUrl="Login .aspx"
> protection="All " timeout="40" path="/" />
> </authentication>
> (Although I would rather not rely on cookies since people can turn them
> off,
> but I got this from an example in a book and couldn't find an example
> of
> how
> to do it without cookies.)
>
> I made sure in IIS the app was an app.
>
> I originally had one of the pages in a separate folder. I thought
> maybe
> that had something to do with it, so I cut and pasted it to the first
> level.
> That did nothing.
>
> Again, any suggestions will be greatly appreciated!
> --
> Sandy


Nov 19 '05 #4
TJS -

Thanks again for your response! At least I know I'm not the only one . . .
Now, how do we go about getting a double-help out there on this one?????
--
Sandy
"TJS" wrote:
For what it'e worth, the redirect back to the selected page before login,
doesn't work for me either.


"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:21******** *************** ***********@mic rosoft.com...
Thanks so much for your response.

The problem is not getting to the login page. It is the redirecting back
to
the original page they came from.

The RedirectFromLog inPage and GetRedirectUrl are supposed to, as a fellow
programmer put it, "automagica lly" redirect back to the page that took
them
to the login page. As I understand it, from all the reading I've done,
both
in books and on the Internet, he is entirely correct . . . however, for
some
reason my machine seems to have a mind of its own and is not responding
correctly. (Of course, I blame it on my box, but we both know who's the
smarter of the two . . .guess I'm doing something dumb - I haven't found
an
instance where anyone has had a problem with this.)

Can you give me another clue?

Again, thanks so much for your response! This is sooooo frustrating!
--
Sandy
"TJS" wrote:
try this
If User.Identity.I sAuthenticated Then
[do whatever here]
Else
response.redire ct("~/login.aspx")
End If


"Sandy" <Sa***@discussi ons.microsoft.c om> wrote in message
news:C6******** *************** ***********@mic rosoft.com...
> Any help anyone can give me will be appreciated!!!! This is driving me
> c-r-a-z-y!
>
> All I can get from both of the above redirections is a redirect to a
> page
> named default.aspx. How do I make either of these work? I have an app
> that
> has two pages that need a login. I need to be able to have it
> automatically
> return to whichever page the user came from.
>
> I've tried both of the following (not together, of course):
> [Button Submit has code to check database]
> FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)
>
> [Button Submit has code to check database]
> Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text,
> False))
>
> My Web Config has this in it:
>
> <authenticati on mode="Forms" >
> <forms name=".LoginCoo kie" loginUrl="Login .aspx"
> protection="All " timeout="40" path="/" />
> </authentication>
> (Although I would rather not rely on cookies since people can turn them
> off,
> but I got this from an example in a book and couldn't find an example
> of
> how
> to do it without cookies.)
>
> I made sure in IIS the app was an app.
>
> I originally had one of the pages in a separate folder. I thought
> maybe
> that had something to do with it, so I cut and pasted it to the first
> level.
> That did nothing.
>
> Again, any suggestions will be greatly appreciated!
> --
> Sandy


Nov 19 '05 #5
Sandy,

If everything else fails, you can append the current page's encoded URL to
your login page's URL(i.e.: Response.Redire ct("login.aspx? currpage=" +
HttpUtility.Url Encode(Request. RawUrl))).

When authenication success, redirect the user using
Response.Redire ct(HttpUtility. UrlDecode(Reque st.QueryString["currpage"]));

Regards,
Lau Lei Cheong

"Sandy" <Sa***@discussi ons.microsoft.c om> ¼¶¼g©ó¶l¥ó·s»D: C6************* *************** ******@microsof t.com...
Any help anyone can give me will be appreciated!!!! This is driving me
c-r-a-z-y!

All I can get from both of the above redirections is a redirect to a page
named default.aspx. How do I make either of these work? I have an app
that
has two pages that need a login. I need to be able to have it
automatically
return to whichever page the user came from.

I've tried both of the following (not together, of course):
[Button Submit has code to check database]
FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)

[Button Submit has code to check database]
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text,
False))

My Web Config has this in it:

<authenticati on mode="Forms" >
<forms name=".LoginCoo kie" loginUrl="Login .aspx"
protection="All " timeout="40" path="/" />
</authentication>
(Although I would rather not rely on cookies since people can turn them
off,
but I got this from an example in a book and couldn't find an example of
how
to do it without cookies.)

I made sure in IIS the app was an app.

I originally had one of the pages in a separate folder. I thought maybe
that had something to do with it, so I cut and pasted it to the first
level.
That did nothing.

Again, any suggestions will be greatly appreciated!
--
Sandy

Nov 19 '05 #6
Lee

When ASP.Net redirects you to the login page, it should append something
to the request URL so that the full url looks something like:
http://www.domain.com/login.aspx?Ret...iousPage.aspx%
3f__redir%3d1&_ _redir=1

the appended query variables :

ReturnUrl=%2fPr eviousPage.aspx %3f__redir%3d1

are an url-encoded form of :

ReturnURL=/PreviousPage.as px?__redir=1

which is what the RedirectFromLog inPage and GetRedirectUrl methods will
use to decide where to redirect to.

Maybe these aren't present on the redirect-to-login-page URL? this would
explain why you're unable to return to the original page.


"=?Utf-8?B?U2FuZHk=?=" <Sa***@discussi ons.microsoft.c om> wrote in
news:21******** *************** ***********@mic rosoft.com:
Thanks so much for your response.

The problem is not getting to the login page. It is the redirecting
back to the original page they came from.

The RedirectFromLog inPage and GetRedirectUrl are supposed to, as a
fellow programmer put it, "automagica lly" redirect back to the page
that took them to the login page. As I understand it, from all the
reading I've done, both in books and on the Internet, he is entirely
correct . . . however, for some reason my machine seems to have a mind
of its own and is not responding correctly. (Of course, I blame it on
my box, but we both know who's the smarter of the two . . .guess I'm
doing something dumb - I haven't found an instance where anyone has
had a problem with this.)

Can you give me another clue?

Again, thanks so much for your response! This is sooooo frustrating!



Nov 19 '05 #7
Lee -

Thank you for your response. Would you happen to have an example of what I
would put in my Login.aspx page code and what I would put in my
AddNewListing.a spx code?
--
Sandy
"Lee" wrote:

When ASP.Net redirects you to the login page, it should append something
to the request URL so that the full url looks something like:
http://www.domain.com/login.aspx?Ret...iousPage.aspx%
3f__redir%3d1&_ _redir=1

the appended query variables :

ReturnUrl=%2fPr eviousPage.aspx %3f__redir%3d1

are an url-encoded form of :

ReturnURL=/PreviousPage.as px?__redir=1

which is what the RedirectFromLog inPage and GetRedirectUrl methods will
use to decide where to redirect to.

Maybe these aren't present on the redirect-to-login-page URL? this would
explain why you're unable to return to the original page.


"=?Utf-8?B?U2FuZHk=?=" <Sa***@discussi ons.microsoft.c om> wrote in
news:21******** *************** ***********@mic rosoft.com:
Thanks so much for your response.

The problem is not getting to the login page. It is the redirecting
back to the original page they came from.

The RedirectFromLog inPage and GetRedirectUrl are supposed to, as a
fellow programmer put it, "automagica lly" redirect back to the page
that took them to the login page. As I understand it, from all the
reading I've done, both in books and on the Internet, he is entirely
correct . . . however, for some reason my machine seems to have a mind
of its own and is not responding correctly. (Of course, I blame it on
my box, but we both know who's the smarter of the two . . .guess I'm
doing something dumb - I haven't found an instance where anyone has
had a problem with this.)

Can you give me another clue?

Again, thanks so much for your response! This is sooooo frustrating!



Nov 19 '05 #8
Lau -

Thanks for the suggestions! I did try the
Response.Redire ct("login.aspx? currpage=" +
HttpUtility.Url Encode(Request. RawUrl))) with success. My redirect included
the correct info in the browser url address.

When I tried to use the other one, in my Login page to redirect back to the
AddNewListing page, I got the blue squiggly line under it. What dumb thing
am I neglecting to do?

--
Sandy
"Lau Lei Cheong" wrote:
Sandy,

If everything else fails, you can append the current page's encoded URL to
your login page's URL(i.e.: Response.Redire ct("login.aspx? currpage=" +
HttpUtility.Url Encode(Request. RawUrl))).

When authenication success, redirect the user using
Response.Redire ct(HttpUtility. UrlDecode(Reque st.QueryString["currpage"]));

Regards,
Lau Lei Cheong

"Sandy" <Sa***@discussi ons.microsoft.c om> ¼¶¼g©ó¶l ¥Ã³Â·s»D:C6*** *************** *************** *@microsoft.com ...
Any help anyone can give me will be appreciated!!!! This is driving me
c-r-a-z-y!

All I can get from both of the above redirections is a redirect to a page
named default.aspx. How do I make either of these work? I have an app
that
has two pages that need a login. I need to be able to have it
automatically
return to whichever page the user came from.

I've tried both of the following (not together, of course):
[Button Submit has code to check database]
FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)

[Button Submit has code to check database]
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text,
False))

My Web Config has this in it:

<authenticati on mode="Forms" >
<forms name=".LoginCoo kie" loginUrl="Login .aspx"
protection="All " timeout="40" path="/" />
</authentication>
(Although I would rather not rely on cookies since people can turn them
off,
but I got this from an example in a book and couldn't find an example of
how
to do it without cookies.)

I made sure in IIS the app was an app.

I originally had one of the pages in a separate folder. I thought maybe
that had something to do with it, so I cut and pasted it to the first
level.
That did nothing.

Again, any suggestions will be greatly appreciated!
--
Sandy


Nov 19 '05 #9
Hi -

Sorry! I just got it to work.

Thanks to all of you!!!
--
Sandy
"Sandy" wrote:
Any help anyone can give me will be appreciated!!!! This is driving me
c-r-a-z-y!

All I can get from both of the above redirections is a redirect to a page
named default.aspx. How do I make either of these work? I have an app that
has two pages that need a login. I need to be able to have it automatically
return to whichever page the user came from.

I've tried both of the following (not together, of course):
[Button Submit has code to check database]
FormsAuthentica tion.RedirectFr omLoginPage(txt UserName.Text, False)

[Button Submit has code to check database]
Response.Redire ct(FormsAuthent ication.GetRedi rectUrl(txtUser Name.Text, False))

My Web Config has this in it:

<authenticati on mode="Forms" >
<forms name=".LoginCoo kie" loginUrl="Login .aspx"
protection="All " timeout="40" path="/" />
</authentication>
(Although I would rather not rely on cookies since people can turn them off,
but I got this from an example in a book and couldn't find an example of how
to do it without cookies.)

I made sure in IIS the app was an app.

I originally had one of the pages in a separate folder. I thought maybe
that had something to do with it, so I cut and pasted it to the first level.
That did nothing.

Again, any suggestions will be greatly appreciated!
--
Sandy

Nov 19 '05 #10

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

Similar topics

0
956
by: Rob O'Cop | last post by:
Hi, I've got an Intranet site that's been using the usual Forms authentication. Now, I want to retrieve the Windows Login and authenticate the user automatically without her typing login+password. Thus I changed the security parameters in IIS (anonymous user unchecked, Windows authentication checked). But I let the Forms in web.config unchanged because I wanna keep the ReturnUrl system because I have some Session parameters that are set...
9
2822
by: Mariam | last post by:
Hi, all, We have mutiple ASP.NET web applications and setup on mutiple web servers (win2k, .netframework 1.1). All the web applications are setup to use Forms authentication. All the applications will be sent to the same application to get authenticated (the authentication tag and the machienkey tag have all been setup properly) and then supposely, redirect back to the originated URL after getting authenticated.
8
2233
by: Edward Mitchell | last post by:
I have a main project that is protected in that the user is directed to a login.aspx file. The text in the web.config file is: <authentication mode="Forms"> <forms loginUrl="Login.aspx" /> </authentication> <authorization>
4
3439
by: jjjooooohhnnn | last post by:
Greetings, I have encountered what appears to be a fairly common problem: RedirectFromLoginPage is not redirecting to RedirectUrl. I have tried all the advice that I could on the 'net, and nothing has worked yet. My problem is very simple. I want to redirect from a login page to the default page in one application. I am not crossing over to other applications in other directories on the server. Here is a description of the problem:
1
3759
by: Jeremy Chapman | last post by:
I have built a web app. While testing I have found that if I browse to a page in the app, then get redirected to the login page and enter my credentials. The FormsAuthentication.RedirectFromLoginPage call is redirecting to the default.aspx page rather than the original page the user was at. Here is the details of my application: Web.config: <authentication mode="Forms">
0
1002
by: Andrew | last post by:
Hello, friends, I used Form authentication. Access to default.aspx is allowed to every visitor, but visiting to \Admin\default.aspx need to authenicated first. When I entered: http://localhost/eventbase/default.aspx I saw the main default.aspx without problem. Then I modified the IE address box to: http://localhost/eventbase/Admin/default.aspx
0
2291
by: stsong | last post by:
I am using FormsAuthentication in VS.NET 2003, but for some reason the authentication code does not work on my home workstation. It works when I run the project in VS.NET 2003 but not on the website on the server.It does not redirecting from the login page, it will just refresh the login page whether I am doing response.redirect or FormsAuthentication.GetRedirectUrl. I have several websites with the same code, and none of them are working...
2
427
by: genc ymeri | last post by:
hi, I'm doping a maintenance for a project but I'm having an interesting issue with RedirectFromLoginPage coomand :) What happens is that the webapp, once user logs in, he/she goes gets redirected by default to the default.aspx page thorugh the RedirectFromLoginPage coomand. What I did, I changed all settting in IIS (set the document to 'login.aspx') and I made the default page in the ASP.net project the login.aspx page. I did look in...
0
1482
by: Imran Aziz | last post by:
Hello All, I cannot seem to get createPersistentCookie option of FormsAuthentication.RedirectFromLoginPage work. Even if I set it to true the cookie is setup to expire after 30 min ( default settings ) Can you please suggest as to what can be done to sort this one out. My code is as under web.config
0
8059
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8145
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,...
0
6815
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5475
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
3960
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...
1
2474
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
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
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.