Is the new one called "Default.aspx" or some other name?
Main Topics
Browse All TopicsHi,
I a newbie, so please be kind. :)
I have a asp.net application that is working just fine before I attempted to integrate it into a asp master page. I have attached the original default.aspx and default.aspx.vb and these files work as desired (the files are attached as OriginalDefault.aspx.txt and OriginalDefault.aspx.vb.tx
What I attempting to do is create a asp master page of the original default.aspx file with a contentplaceholder section (handymansuccess.master is the master). I then created a new default.aspx file using handymansuccess.master as the master file. Everything in the new default displays just fine, but the vb code does not seem to be working. It does not add the information to the database, nor does it send the email.
I would appreciate any help understanding and correcting the apparent mistake that I have made in creating the master page, the associated default.asp, and the code behind file. I'm learning how to do this and any additional guidance would be very much appreciated. I have attached the file mentioned above for reference.
Thanks a bunch!
Brian
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You will also need to rename the class name. Open up originaldefault.vb and you will see a line at the top of the page says: Partial Class _Default, change "_Default" to OriginalDefault.
Then open originaldefault.aspx in HTML mode, at the very top of the page where says CodeFile="Default.aspx.vb"
Run your code again to see if it works.
prairedog,
Thanks, however the one I'm trying to make work is the new default and the associated code behind file that are based on the master page. In other words, I'm trying to get default.aspx and default.aspx.vb working. I provided the original files as a reference to help others help me. Sorry about any confusion.
Brian
I understood your problem.
Since you kept the old default page, and its class name is also call "partial class _Default", which means you have two classes with the exactly same name in your application. It might be the problem, because the new default.aspx does not know which class to call to. If you don't want to change those names, then you can temporarily exclude them from yoru project and then run your application to see if ti works.
Becuase I only want to use the new default.aspx file based on the master page, I deleted the old, original, versions from the directory. Now I only have default.aspx, default.aspx.vb and the masterfile file in the directory. Thes files match the two file I uploaded ealier, default.aspx(.txt) and default.aspx.vb(.txt). I added the extension txt to allow the files to upload.
Now I believe I only have one class named '_Defualt' in the code behind file default.aspx.vb. With this change I get the same results as articulated earlier. The database does not update nor is any email sent. When the submit button is clicked I get the message "Sorry, an error occured. Please try again later."
P.S. I'll be leaving shortly, so it will be later tonight or tomorrow morning before I can check back in. Thanks for the help. I will try to check right before I leave.
It looks like that an exception ocurred while trying to send email. Change your try/catch block as follows:
Try
body = String.Format("New Registration: " + System.Environment.NewLine
OptInName.Text + ", " + OptInEmailAddress.Text)
Dim toAddress As String = OptInEmailAddress.Text
'email = New MailMessage("email@address
email = New MailMessage("email@address
email.Attachments.Add(New Attachment(Server.MapPath(
smtp.Credentials = CredentialCache.DefaultNet
smtp.Send(email)
AddRegistrationToDB(OptInN
Response.Redirect("ThankYo
Catch ex1 As System.Threadign.ThreadAbo
Catch ex As Exception
'Temporarily remove lines so that we can see the error message.
End Try
I added another Catch because Response.Redirect will also generate an exception, but we don't need to worry about that exception.
Re-run your app and post the error message.
Ok, I changed it accordingly. When I entered the information it simply 'refreshed' the screen. Leaving what I typed into the fields and showed no error message. I checked the database and no new entry nor was the email delivered.
Here is what I have in the default.aspx.vb file...
Response.Redirect("ThankYo
Catch ex1 As System.Threading.ThreadAbo
Catch ex As Exception
' lblMessage.Visible = True
' lblMessage.Text = "Sorry, an error occurred. Please try again later."
End Try
Prairiedog,
I would set the break point if I could. I have created this code on my pc and I upload this to my server.
The part of this that is truely strange is that if I place the original versions of default and the leave the same code behind file, default.aspx.vb, it works just fine. It was only when I created the master page and then created the new default from the master file that this stopped working.
Based on the chain of events I think the default.aspx file is where something is messed up.
Thanks!
Brian
prairiedog,
In a fit of despration, I deleted the entire directory on the server and recopied all the files to the server. Something must have been corrupted as it all works fine now. This is really strange.
I guess the moral of this situation is when nothing makes much sense, delete and restart!
Because of you quick and continued responses to my posts I'm going to mark your last message as the solution. You do deserve it!
Thanks,
Brian
It seems that your app on the production server was still using the old dll after you add the new page. It happens sometime and that is why I asked the dummy question before if you compile your app before uploading it.
In the future, under "Build" menu, there is an option called "Clean Solution" which will delete the old dll's from bin folder and create new ones.
Also, it will be better if you can test your app on your local machine first, then deploy to the production server, so you should install MySQL on your pc.
Business Accounts
Answer for Membership
by: prairiedogPosted on 2009-06-09 at 10:01:53ID: 24583186
After creating the new default.aspx, did you delete or exclude the old one?