I am trying to show display reset password screen if data reader fetches records from the database matching the current user's information.
However, no matter what I try, I always get the following message:
Reset password link has expired.It was for one time use only
Any idea what I need to change in the code below?
Thanks in advance
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim dr As OleDbDataReader
'Here we will check from the passed querystring that if the email id/username and generated unique code is same then the panel for resetting password will be visible otherwise not
cmd = New OleDbCommand("select UserName,myemail,[UniqueCode] from tblusers where [UniqueCode]=@uniqueCode and (myEmail=@emailid or UserName=@username)", con)
If con.State = ConnectionState.Closed Then
dr = cmd.ExecuteReader()
If dr.HasRows Then
ResetPwdPanel.Visible = True
ResetPwdPanel.Visible = False
lblExpired.Text = "Reset password link has expired.It was for one time use only"
Catch ex As Exception
lblStatus.Text = "Error Occured: " & ex.Message.ToString()
F-ES Sitecore explained that no one here has any idea what is in your database, or what the values of the parameters in your SELECT statement are. So how exactly do you think anyone here could guess why it returns no rows? Use your debugger to examine exavctly what the parameter values are and see whether they match a record in the database.
I don't understand what you mean by you don't know my inputs.
Inputs are what go in to your system so in your case the inputs are Request.QueryString("uCode"), Request.QueryString("myMail") and Request.QueryString("uName"). We don't know what values you are using as we don't know what the url you are using to access your page is. You could have helped by saying in your question, "This is the url I use..." and that would have given us some idea. It probably wouldn't help though.
Secondly we don't know what is in your database, the most likely issues is that there just isn't a row that satisfies your query. As we don't know your inputs nor your data how can we possibly say?
Asking questions is a skill, so what you should do is post the url you are using and an example of the row of data in your database that you think satisfies your query. The issue might be white spaces, or I see you are using an email address so maybe you are not properly encoding the "@"? As I said, how can we know as you didn't supply enough info? Even with the info I just said you should provide, maybe you are mistaken about your connection string and are connecting to a different database than the one you think you are? If you think that's stupid then I've seen it many many times.
When it comes to questions like this, the best solution by far is for you to learn how to debug your code. Use the debugger to examine the inputs and the query, use SQL Profiler to see exactly what query is being executed, and use SQL Management Studio to run that query and\or examine the data in your database to see if you can work out why nothing is being returned. What I am basically saying is that your code is only half of the issue, the data is the other, and there doesn't seem anything wrong with your code so the issue is with the data which we can't see.
I have been tasked with moving an ASP .NET production servers web application from a 2008 Windows server to a 2012 Windows server. I do not have the application's source code and only have the deployed to IIS application files. Can I do this and if so does anyone know of an artical to instruct me on doing so?
This is more a CSS issue. You can't print to the client's machine via asp.net code, and your asp.net code runs in its entirety before sending anything to the client so you can't "loop" the way you are intending.
Instead send all 7 pages to the client with the relevant css that designates where the page breaks are and the client will need to print from their browser (no you can't do that automatically either, neither can you force them to print) and the documents will be on their own pages. Google for css page breaks or for print style css in general.
I'm struggling with navigation in asp.net mvc and URLs.
When you are visiting your profile at facebook, the url is facebook.com/yourusername.
At your profile there is a menu with the following links: Timeline, About, Friends etc.
When you click on one of these links, for example Photos, the URL is changed to facebook.com/yourusername/Photos, and the photos are rendered. The menu described above are still there, and so also the profile picture and the cover picture. Its like a partial view has rendered viewing the photos.
I want to accomplish this effect in my project, but I don't know how to do it. I have tried to do it with Partial view but the problem is that the URL is not changed when the partial view is rendered.
Anyone can help me with this? How should I structure it?