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]
FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False)
[Button Submit has code to check database]
Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, False))
My Web Config has this in it:
<authentication mode="Forms" >
<forms name=".LoginCookie" 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 9 3553
try this
If User.Identity.IsAuthenticated Then
[do whatever here]
Else
response.redirect("~/login.aspx")
End If
"Sandy" <Sa***@discussions.microsoft.com> wrote in message
news: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] FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False)
[Button Submit has code to check database] Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, False))
My Web Config has this in it:
<authentication mode="Forms" > <forms name=".LoginCookie" 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
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 RedirectFromLoginPage and GetRedirectUrl are supposed to, as a fellow
programmer put it, "automagically" 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.IsAuthenticated Then [do whatever here] Else response.redirect("~/login.aspx") End If
"Sandy" <Sa***@discussions.microsoft.com> wrote in message news: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] FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False)
[Button Submit has code to check database] Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, False))
My Web Config has this in it:
<authentication mode="Forms" > <forms name=".LoginCookie" 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
For what it'e worth, the redirect back to the selected page before login,
doesn't work for me either.
"Sandy" <Sa***@discussions.microsoft.com> wrote in message
news:21**********************************@microsof t.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 RedirectFromLoginPage and GetRedirectUrl are supposed to, as a fellow programmer put it, "automagically" 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.IsAuthenticated Then [do whatever here] Else response.redirect("~/login.aspx") End If
"Sandy" <Sa***@discussions.microsoft.com> wrote in message news: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] > FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False) > > [Button Submit has code to check database] > Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, > False)) > > My Web Config has this in it: > > <authentication mode="Forms" > > <forms name=".LoginCookie" 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
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***@discussions.microsoft.com> wrote in message news:21**********************************@microsof t.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 RedirectFromLoginPage and GetRedirectUrl are supposed to, as a fellow programmer put it, "automagically" 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.IsAuthenticated Then [do whatever here] Else response.redirect("~/login.aspx") End If
"Sandy" <Sa***@discussions.microsoft.com> wrote in message news: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] > FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False) > > [Button Submit has code to check database] > Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, > False)) > > My Web Config has this in it: > > <authentication mode="Forms" > > <forms name=".LoginCookie" 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
Sandy,
If everything else fails, you can append the current page's encoded URL to
your login page's URL(i.e.: Response.Redirect("login.aspx?currpage=" +
HttpUtility.UrlEncode(Request.RawUrl))).
When authenication success, redirect the user using
Response.Redirect(HttpUtility.UrlDecode(Request.Qu eryString["currpage"]));
Regards,
Lau Lei Cheong
"Sandy" <Sa***@discussions.microsoft.com> ¼¶¼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] FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False)
[Button Submit has code to check database] Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, False))
My Web Config has this in it:
<authentication mode="Forms" > <forms name=".LoginCookie" 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
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=%2fPreviousPage.aspx%3f__redir%3d1
are an url-encoded form of :
ReturnURL=/PreviousPage.aspx?__redir=1
which is what the RedirectFromLoginPage 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***@discussions.microsoft.com> wrote in
news:21**********************************@microsof t.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 RedirectFromLoginPage and GetRedirectUrl are supposed to, as a fellow programmer put it, "automagically" 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!
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.aspx 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=%2fPreviousPage.aspx%3f__redir%3d1
are an url-encoded form of :
ReturnURL=/PreviousPage.aspx?__redir=1
which is what the RedirectFromLoginPage 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***@discussions.microsoft.com> wrote in news:21**********************************@microsof t.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 RedirectFromLoginPage and GetRedirectUrl are supposed to, as a fellow programmer put it, "automagically" 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!
Lau -
Thanks for the suggestions! I did try the
Response.Redirect("login.aspx?currpage=" +
HttpUtility.UrlEncode(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.Redirect("login.aspx?currpage=" + HttpUtility.UrlEncode(Request.RawUrl))).
When authenication success, redirect the user using Response.Redirect(HttpUtility.UrlDecode(Request.Qu eryString["currpage"]));
Regards, Lau Lei Cheong
"Sandy" <Sa***@discussions.microsoft.com> ¼¶¼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] FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False)
[Button Submit has code to check database] Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, False))
My Web Config has this in it:
<authentication mode="Forms" > <forms name=".LoginCookie" 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
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] FormsAuthentication.RedirectFromLoginPage(txtUserN ame.Text, False)
[Button Submit has code to check database] Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text, False))
My Web Config has this in it:
<authentication mode="Forms" > <forms name=".LoginCookie" 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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...
|
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" />...
|
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...
|
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...
| |
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:...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |