Change GetRedirectUrl


 Hi,
using vb.net 2003 asp.net 1.1

I cannot use defaultUrl in my config file because
1.1 doesn't have it.

I need for my users to be sent to my Default.aspx
page after they login after being redirected from any
page, I need to change the GetRedirectUrl to always
be Default.aspx.

I have denied users on some pages in my config and I
don't want them being sent back to that page after login.

Every user needs to be sent to Default.aspx and go from there.

Anybody know how I can change the code below to do
that.

Private Sub btnLog_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnLog.Click

Dim accountSystem As Manager.CustomerDB = New Manager.CustomerDB

Dim customerID As String = accountSystem.Login(Server.HtmlEncode(UserName), BoSec.Security.Encrypt(Password))

If customerID <> "" Then

Dim customerDetails As Manager.Customer = accountSystem.GetCustomerDetails(customerID)

Dim Persist As Boolean = cbx.Checked

Dim userData As String = customerDetails.LastName

Dim objTicket As New FormsAuthenticationTicket(1, ".ASPXAUTH", Now, Now.AddMonths(1), Persist, userData, FormsAuthentication.FormsCookiePath)

Dim encTicket As String = FormsAuthentication.Encrypt(objTicket)

Dim objCookie As New HttpCookie(encTicket)

If objTicket.IsPersistent Then

objCookie.Expires = objTicket.Expiration

End If

Response.Cookies.Add(objCookie)

Dim url As String = FormsAuthentication.GetRedirectUrl(".ASPXAUTH", Persist)

Dim urlDefaultPage As String = "Default.aspx"

If url.EndsWith(urlDefaultPage) Then

Response.Redirect("Default.aspx")

Else

'url.EndsWith(urlDefaultPage)

Response.Redirect("Default.aspx")

End If

''''FormsAuthentication.RedirectFromLoginPage(".ASPXAUTH", Persist)

''''Response.Redirect(FormsAuthentication.GetRedirectUrl(".ASPXAUTH", Persist))

''''Response.Redirect("Default.aspx")

Else

pan1.BorderColor = Color.Red

pan1.BorderWidth = Unit.Pixel(5)

End If

End Sub

 

Thanks

Steve

0
Steve06
5/4/2009 12:44:14 AM
asp.net.security 27051 articles. 1 followers. Follow

6 Replies
1200 Views

Similar Articles

[PageSpeed] 12
Get it on Google Play
Get it on Apple App Store

 Seems like an easy fix would be to pop this into your web.config

<authentication mode="Forms">
      <forms name="Sample" loginUrl="Default.aspx" timeout="300" slidingExpiration="true"/>
    </authentication>

0
cartaysmm
5/4/2009 3:11:26 AM

No, I'm talking about if they go to another page

like ThisPage.aspx they are the sent to login.aspx

and after they login they are sent back to ThisPage.aspx

If I sent them to default.aspx to login then they would

still be directed to ThisPage.aspx.

 I did try your solution prior to posting.

 

Steve

0
Steve06
5/4/2009 3:35:12 PM
Dim url As String = FormsAuthentication.GetRedirectUrl(".ASPXAUTH", Persist)

Dim urlDefaultPage As String = "Default.aspx"

If url.EndsWith(urlDefaultPage) Then

Response.Redirect("Default.aspx")

Else

'url.EndsWith(urlDefaultPage)

Response.Redirect("Default.aspx")

End If

Not sure if I got it right ...but no matter what you are redirecting users to Default.aspx ... are you htting any of the Redirect Statement during debugging?

As per my understanding the two steps once user credentials are validated is....1: Set authentication cookie -- 2: Redirect the user.

so your code should work....


/GuruBhai
0
guru_sarkar
5/4/2009 3:46:50 PM

My code returns to default.aspx with no cookie

info.

The code just asks if the url ends with default.aspx.

I would need to change the GetRedirectUrl.

0
Steve06
5/4/2009 9:44:03 PM

then may be something wrong going with your FormsAuthentication cookie...

Check Step 4: of this tutorial: http://www.asp.net/learn/security/tutorial-03-vb.aspx

you might get some hint...


/GuruBhai
0
guru_sarkar
5/4/2009 10:22:40 PM

When you mentioned SetAuthCookie something clicked

and I read a little bit and think I can use just SetAuthCookie

and the just Resonse.Redirect("Default.aspx")

 

Thanks

Steve

0
Steve06
5/4/2009 11:04:09 PM
Reply:

Similar Artilces:

Changes to FormsAuthentication.GetRedirectUrl in .Net 2.0
Hi, In .Net 1.1 we had been using FormsAuthentication.GetRedirectUrl() to redirect user to default.aspx after the user has successfully logged in. Now, we are moving to .Net 2.0 and in .net 2.0 this method normally works but when the session is expired the user is redirected back to the screen on which the session had expired. This is the change in .Net 2.0, previously in .Net 1.1 it would redirect to default.aspx however now it's redirected to returnurl. For us this creates a problem as when the user is redirected to the same screen on which his session got expired most of the time he ...

Working with SLL
I have my site finally working fine with IsSecure and have written quite a bit of code to send you from the Non Secure site to https://www.MySite.com/Member/Login.aspx?Notice=True&ReturnUrl=(http://www.MySite.com/Directory/OrLastPage)This is great and working well for Registration and Logins. How ever I do not want the entire site to be accessible from IsSecure but I do want 16 of 180 pages to automaticly do switch betweens https and http. If you access any of the other pages it should redirect you back to http://Is there not a way to set this up in the web.sitemap's like we can with...

How to change vb.net code to C#.Net ?...
Hi, Earlier i had a class  that i got it from this Forum, it in vb.net and i am trying it to convert it in c#.net but i am unable to covert properly to work. the functionality of this class is to convert number value to words. i am putting both of code c#.net and VB.net please rectify it.Public Class NumberToWords Dim Character As String Public Function ConvertNumber(ByVal A As Double) As String On Error Resume Next Dim MM Dim IM ConvertNumber = "" MM = Microsoft.VisualBasic.Len(A) IM = Microsoft.VisualBasic.Left(A, Mic...

(IN)SECURE Magazine from Net-Security (PDF download)
A little more light reading :-) Latest issue, #13: http://www.net-security.org/insecuremag.php (86 pages, with ads [not animated ads] - like a printed magazine) Archives of past issues: http://www.net-security.org/insecure-archive.php ISSUE 13 (September 2007) * Interview with Janne Uusilehto, Head of Nokia Product Security * Social engineering social networking services: a LinkedIn example * The case for automated log management in meeting HIPAA compliance * Risk decision making: whose call is it? * Interview with Zulfikar Ramzan, Senior Principal Re...

Security in .NET
hi All, I m make a application, here, user can view some page or some not, So which type of security i can use, Page Level security means, every time when page,this check user is valid or not, or User level, means every time user login, check those pages user can visit. which type of tecnique is best regarding security and performence... plz discuss in detial thanx in advance Sajjad Please Mark as Answer, if the post Solve your Problem__________________________Regards,Sajjad RizviC U ON NETreply me : sajjaddotnet@yahoo.com Windows authentication  - for intranet scenarios. F...

security change
How can I get FF to let me go to my stated home page which is my yahoo.com without making me sign in each time. I think this problem started with the latest FF update. I don't have clear cookies on exit checked. ...

Is .NET Secure?
Here's the scenario. I want to develop a website that is hosted by a third party (shared web host initially) that contains sensitive data.    I encrypt / decrypt the data (that is stored on the SQL server encrypted) at the data access tier to StringBuilders and pass them up the business logic layer to the presentation layer. When the data hits the presentation tier, in this case the web page, I must convert them to String so that I can display them as you cannot simply point web controls to StringBuilders . When the page is rendered, these strings&nbs...

security too secure
Name: joe Product: Firefox Summary: security too secure Comments: The security thing won't let me in this sight no matter how I accept, confirm, get certificate, etc. https://www.vtext.com/customer_site/jsp/messaging_lo.jsp Browser Details: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-GB; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Changing the default font size is VS.net for VB.net
Subject kinda says it all. Surely there must be a way to changing the default font size for the items in the forms. Thanks for the help in advance. Daniel Yes in Tools Options, I believe its Text Editor > Basic. BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4)....

How secure is secure?
Thanks to this group and all the high tech individuals who frequent it I have learned how to protect my PC from the inside out. But what about security risks to my info 'before' it gets to my computer? Like my mail box on the server. Could someone hack into that and thumb through my mail? If so, how would I ever know? (The short story) We have a rogue employee at my work who one day decided to run the web site, she got in tight with the ISP, got tools to set and delete passwords on a protected directory on the server. Who knows if she has telnet access to other things, li...

Security Briefs: Security Enhancements in the .NET Framework 2.0
Security Briefs: Security Enhancements in the .NET Framework 2.0 http://msdn.microsoft.com/msdnmag/issues/05/01/SecurityBriefs/default.aspx *********************************************************** Quote *********************************************************** As I write this column, version 2.0 of the Microsoft .NET Framework is at Beta 1. When I got my bits, I hacked together a little program to dump all of the public members of all public types in the entire Framework and ran it on version 1.1 as well as 2.0. I then used WINDIFF.EXE to compare the two text files, and s...

about net security
Name: Nasir Email: nasi81ataoldotcom Product: Firefox Summary: about net security Comments: Dear Sir Please tell me that if I use firefox for browsing any type of web site, can it would be checked by my administrator that which type of web sites are to be open at my system or not? Mean the Administrator can check or not the sites which I used to open at my system? Waiting your reply Thanks & Regards Nasir Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 From URL: http://hendrix.mozilla.org/ Note ...

.net Security
Hi.Please explain me about declarative security & imperative security.Thanks in advance.(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)Best Regards,Michael SyncMicrosoft WPF & Silverlight InsiderBlog : http://michaelsync.net Declarative security is where you establish Code Access Security requirements through the use of attributes attached to classes and methods. Imperative security is where you interact with the security engine using method calls.RegardsDave Thanks so much..(If this has answered your question, please clic...

Security in .net
Dear friends i have created applications projects and also  give the permission to download through web.but every month client have to  get new registration number then only that applications will work.other wise it will get expires .give the idea how to do that .. Hi, inbaathere are a lot of ways to implement such an application. You have 2 main choices to make - to use the direct URL to your file (for example http://yoursite.com/downloads/somefile.zip) or to use common download page ( for example http://yoursite.com/download.aspx?fileId=23423154243 ).1) If you choose the first ...

Web resources about - Change GetRedirectUrl - asp.net.security

Resources last updated: 12/16/2015 3:14:37 PM