Why is my ASP.NET site not logging PDFs it generates in SQL DB or sending emails?


I have a site created in ASP.NET used to generate sales quotes.  I am trying to migrate it from a Windows 2003 server with IIS 6.0 to a Windows 2008 server with IIS 7.5.  The existing version connects to a SQL 2005 database, housed on the same server as the site (the new server has SQL 2008).  When authorized users connect to the site (via AuthentiX), they are asked to select an item to quote from a list and add it to the quote.  A popup appears to select options (the user just enters a quantity next to each option desired), which they are then asked to add to the quote.  The next page allows them to add taxes, fees, and shipping or other miscellaneous charges.  The users are then prompted to enter the sales person's name, email, and mailing address, plus the same information for the customer.  The final page allows the user to review the quote, then submit it or go back and change it.  When the user submits the quote, five things happen:

A scrolling progress bar appears.
The quote information is entered into one of three tables the SQL database (for general information, what item was quoted, and what options).  There is a separate SQL user for the quote site which is set as the DB owner.
A PDF file for the quote is generated and stored on the server, and the name of the file is stored in the 1st SQL table mentioned above (quotes).
Emails are generated and sent to the salesman and customer whose email addresses were entered in the quote, plus our inside sales rep (their email address is stored in the site code).
The progress bar is replaced by a confirmation screen, whereby the user can view the PDF file or go back to the initial quote screen.

As of now, the progress bar disappears and I end up back at the quote review screen.  In addition, the emails are never sent (the sales rep and I don't see them because I've used my personal and work emails in testing).  Finally, clicking on the "View PDF" button initially resulted in a HTTP 403 error.  I could also click on a "Quote History" button to review that user's past quotes (where they can view, edit, or delete their quotes), and that View PDF button also doesn't work for new quotes.  However, I can view PDFs of past quotes.  When I looked at the database through MS Access, I found the field where the file name of the PDF is supposed to be is blank on the new test quotes.  I know the PDF exists because I can go the the file folder where the PDFs are stored and see it.  Email should be working because I have and SMTP virtual server set up in IIS and it is authorized to connect to our Exchange server.  After researching the matter of the PDFs, I suspected a permissions issue.  One solution suggested enabling Directory Browsing, which I did.  I can now view the PDFs for my test quotes, but only because I am now presented with the list of all of the quotes ever generated on the site (not the desired solution).

So the question is, how can I get the emails the send (I suspect I'm still missing a permission setting somewhere), as well as get the PDF information into the SQL database?  I am attaching the portion of the site code where the PDF is generated and stored, and the confirmation page is displayed.
Michael BentfeldAssistant Network AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Assign the return values for sendMail and your Update (cmd.ExecuteNonQuery()) to strings and output the value.   It may be returning a message that your code is ignoring.  

It looks like your SQL statement is correct.

As a side note, you may want to into parameterizing your sql statement to prevent sql injection.
Michael BentfeldAssistant Network AdministratorAuthor Commented:
I was wondering if you could elaborate on this a little more.  Pardon my ignorance, but I have very limited knowledge (almost none) in programming or working with asp or visual basic.  I did not originally create this site, and I am unable to contact the person who did.  If you think it would help, I can provide more of the code.  Thanks again for your help.

Dim strSendMailRet, strSQLRet as String

then change the beginning of the code of    general.sendMail(  and  cmd.ExecuteNonQuery()
strSendMailRet = general.sendMail(......
strSQLRet = cmd.ExecuteNonQuery()

At the end add
Lfinalmsg.Text = Lfinalmsg.Text & "<br/> SendMailRet: " & strSendMailRet
Lfinalmsg.Text = Lfinalmsg.Text & "<br/> SQLRet : " & strSQLRet

They may return a something..  a 0 is usually Ok.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Michael BentfeldAssistant Network AdministratorAuthor Commented:
Just tried your suggestions, but I didn't get anything back unfortunately.  I checked the database again (I have it connected to an Access 2007 front end on the server), and the quote was generated.  My prior research indicated that there could be permission issue somewhere, but I haven't been able to find anything.  The only other thing I can think of on that line of thought is I did a new restore of the SQL database last month of a new backup from the original server to keep the quote numbers in sync (the original restore was done some time before), and maybe those permissions got messed up in the process.

Unfortunately, I've got a mini vacation coming up with the family, so I may be delayed in responding for a couple of days (sorry about that).
Ok. You restored.   Let's see.
It does insert the quote.  So insert permissions are ok.  Check the user account to see if Update is set to allow.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael BentfeldAssistant Network AdministratorAuthor Commented:
That may be the problem.  I tried to check the permissions for the user for db (there's a dedicated user named quote), but got nothing, though I suspect my query syntax was incorrect.  However, when i checked in SQL Server Management Studio under the Logins, I found that user doesn't have User Mapping set to that database (though it is set to their default database).  They are also the database owner, so wouldn't it stand to reason they should have full permissions?  I did try looking at the database properties, and noticed that only the Update permission wasn't checked under any option, so I checked that.  I will try over the weekend and advise.  Thanks again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.