0

I'm developing an app using asp and vb.net. Hitting a db that is sql2008 r2. There's an internal app which sends an email to a customer. the email contains a link which the customer clicks on, and then the page load of that page updates a database sitting on our dmz. I'm trying to write a service then which will query this database at various times, and then, based on that result, fire off an email to an internal group. Originally this was set up to fire the email from the box on the dmz, however our NA doesn't like having port 25 open like that, so now I have to rebuild the app internally to query that database, so that the inbound email can be generated on an internal box.

SO... my problem is making the connection in Visual Studio (2012). When you configure the sql data source to a box inside the network, all you need is the name of the server, and you'll get the drop down populated with the databases. At first VS wouldn't see the server at all. We turned on "named pipes" on the server, and then I entered the server name as ip,80 (this is the only port the NA will allow open) and now it will see it, however, before the dropdown gets populated, I get an error saying "A connection was successfully established with the server, but then an error... an existing connection was forcibly closed by the remote host." I know sql normally runs on port, what, 1443? something like that? but if I do that, it goes back to not being seen.

Is there a way to configure the sql data source to see this server? I've researched for a couple of days, but generally the topics have been working the other direction, or related to sporadic issues, which this isn't. Our NA isn't much of a programmer, so he doesn't know much about my end, only that he seems sure that using named pipes is the way I need to get in... however, beyond enabling them on the server, I don't know much about them, or if VS can even use them...

thanks in advance. (I've been coming to this site for a long time now for answers; this is the first time I've ever had post a question)

Jon
  • 301
  • 1
  • 5
  • 19

1 Answers1

0

Wow, a MS SQL Server in your DMZ???

Short answer is to tell your NA he doesn't need to open port 25 for you to SEND an email, unless there is some part of the story I am missing.

The better answer, get that server out of the DMZ and create a web service. They are easy and can be made very secure.

Steve
  • 5,585
  • 2
  • 18
  • 32
  • The server only holds the data related to our public website; there's nothing critical there. And wasn't my original solution (where the webpage load event fired off the email) what you were talking about with the web service? How can a web page build and send an email without referencing an smtp host? if this can be done, then this project will be done in an hour or so... – Jon Oct 14 '13 at 21:55
  • I was talking about getting your SQL Server out of the DMZ and creating a Web Service to communicate with it. But you can you a Web Service to do about anything you want. You create/code the Web Service, so it wont be done in an hour. ha ha. – Steve Oct 14 '13 at 22:11
  • Is you web server in the DMZ? And this is why you have your SQL Server in the DMZ, to talk to it? And now your on your local network trying to talk to the SQL Server in your DMZ? Is this right, walk me through what your trying to do. The question above was not so clear. – Steve Oct 14 '13 at 22:15
  • yes, both the web server and the database that I'm trying to access are on the dmz. The original plan was that when the customer arrived at the webpage, the load event would build and send an email right there - no need for a database at all - but in order for the page to use a valid smtp host to send that email, we had to have port 25 open, which our Net admin no longer wants to allow... so my new plan was to write to the database (it's not sensitive info, so it can be out on that box) and then just try and query it from an internal webpage or service and send emails from there..make sense? – Jon Oct 15 '13 at 14:52
  • Still not sure why 25 must be open. Firewalls prevent incoming traffic and sending the email should not require 25 to be open in your firewall. But I digress. – Steve Oct 15 '13 at 15:09
  • Thought about your problem a lot and I see 2 chioces, either create a web service on your server that you can query, as you are trying to do now, on a regular bases from your local network. Or, since you are obviously familiar with ASP, create an asp page you can query for your data. Look into [ASP to return CSV](https://www.google.com/#q=aspx+return+csv) – Steve Oct 15 '13 at 15:12
  • the impression I got was that the port needed to be open so I could access the smtp host from the web page that the customer would arrive at (located on dmz.) I googled the crap out of it, but couldn't find anything anywhere on sending an email without this link. this would be the ideal solution, though, as I already have that page built; just keep getting the "actively refused" error when the code gets to emailmessage.send()... – Jon Oct 15 '13 at 15:29
  • I'm pretty familiar with both VB and ASP, and I know sql ok (at least the database structure parts) but csv is something new... from what I can see though, isn't that just keeping the data in a different format? storing the data isn't as much the issue, unless there's a different "place" to put it that would be more easy to access than a sql table on that dmz... it's a simple query string (about 300 characters) that's coming in; one other idea I had was somehow telling that webpage to write it to an internal database, but from what the NA says, this would just be opening up a different port... – Jon Oct 15 '13 at 15:35
  • He is correct, your still in the same boat. But, What I was talking about is 1: you have an application that runs in say *MS Sceduler* on some local computer on some interval. 2: This program calls an ASP page on the web server. 3: This ASP page queries your database for any emails that need to be sent. 4: This asp page, instead of returning HTML, returns a CSV, that you can easily parse. 5: You now take this data (from the CSV) and send the emails, from your internal server/pc. Make sense now? – Steve Oct 15 '13 at 15:57
  • ahhh. that is a totally different approach. That's actually a great idea. I'm going to play around with that... sounds like just what I'm looking for. Thanks a bunch! – Jon Oct 15 '13 at 17:07