473,383 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Is it a mistake to put passwords in an .asmx.cs file on the web server?

Hi,

I'm building a web service which connects to a database. I have
hardcoded the connection string in the web service source code (an
asmx.cs file).

Is this a mistake? Is there someplace else I should put the database
connection string or just the password?

BTW, is it a bad idea to leave .asmx.cs files on the web server? I
don't think they need to be there for the app to function. I wonder
why Visual Studio doesn't leave them on my local disk?

Thanks,
John
Nov 18 '05 #1
6 1649
There is no need to put the .cs file up there, since everything is compiled.
It is recommended that you do not hard code passwords or connection strings,
since every time that changes, you have to recompile. It is much easier to
change a configuration file.

I don't know how you are copying the files over, but VS.NET probably thinks
you want the whole project up there if that is what you are copying.

You can just copy all the necessary files by hand, so only the minimal is
there.

"John" <jo********@hotmail.com> wrote in message
news:d8**************************@posting.google.c om...
Hi,

I'm building a web service which connects to a database. I have
hardcoded the connection string in the web service source code (an
asmx.cs file).

Is this a mistake? Is there someplace else I should put the database
connection string or just the password?

BTW, is it a bad idea to leave .asmx.cs files on the web server? I
don't think they need to be there for the app to function. I wonder
why Visual Studio doesn't leave them on my local disk?

Thanks,
John

Nov 18 '05 #2
Are you using "Copy Project"? If so, you should see the option to copy
"Only the files needed to run the application", which won't put source
files on the server.

HTH,

--
Scott
http://www.OdeToCode.com

On 21 Jun 2004 08:50:40 -0700, jo********@hotmail.com (John) wrote:
Hi,

I'm building a web service which connects to a database. I have
hardcoded the connection string in the web service source code (an
asmx.cs file).

Is this a mistake? Is there someplace else I should put the database
connection string or just the password?

BTW, is it a bad idea to leave .asmx.cs files on the web server? I
don't think they need to be there for the app to function. I wonder
why Visual Studio doesn't leave them on my local disk?

Thanks,
John


Nov 18 '05 #3
Thanks for your posting.

I started Visual Studio and told it I wanted to create a new web
service. It asked for the URL and I gave the URL to my site (hosted by
a hosting company).

Is there something I should do to tell VS to not upload the cs files?
I really like that when I press CONTROL-ALT-B the solution is built
and uploaded to the server for me to test.

I see that the solution is stored locally. I kind of like this because
I can take the .sln file home with me and all the code is on the
hosting server so as long as I delete my VSWebCache directory I can
work on the code from both places. Is this a bad thing to be doing?

John

Scott Allen <bitmask@[nospam].fred.net> wrote in message news:<9q********************************@4ax.com>. ..
Are you using "Copy Project"? If so, you should see the option to copy
"Only the files needed to run the application", which won't put source
files on the server.

HTH,

--
Scott
http://www.OdeToCode.com

On 21 Jun 2004 08:50:40 -0700, jo********@hotmail.com (John) wrote:
Hi,

I'm building a web service which connects to a database. I have
hardcoded the connection string in the web service source code (an
asmx.cs file).

Is this a mistake? Is there someplace else I should put the database
connection string or just the password?

BTW, is it a bad idea to leave .asmx.cs files on the web server? I
don't think they need to be there for the app to function. I wonder
why Visual Studio doesn't leave them on my local disk?

Thanks,
John

Nov 18 '05 #4
Thanks for your reply.

Where should I put the password and connection strings if not hardcoded?

Do you know how to tell VS to not put the whole project up on the server?

Thanks,
John

"Marina" <so*****@nospam.com> wrote in message news:<ez**************@TK2MSFTNGP12.phx.gbl>...
There is no need to put the .cs file up there, since everything is compiled.
It is recommended that you do not hard code passwords or connection strings,
since every time that changes, you have to recompile. It is much easier to
change a configuration file.

I don't know how you are copying the files over, but VS.NET probably thinks
you want the whole project up there if that is what you are copying.

You can just copy all the necessary files by hand, so only the minimal is
there.

"John" <jo********@hotmail.com> wrote in message
news:d8**************************@posting.google.c om...
Hi,

I'm building a web service which connects to a database. I have
hardcoded the connection string in the web service source code (an
asmx.cs file).

Is this a mistake? Is there someplace else I should put the database
connection string or just the password?

BTW, is it a bad idea to leave .asmx.cs files on the web server? I
don't think they need to be there for the app to function. I wonder
why Visual Studio doesn't leave them on my local disk?

Thanks,
John

Nov 18 '05 #5
Hi John:

When you create the web service in this fashion there there is no way
to keep the source code files off the server. There is nothing
inherently wrong or bad about this approach - it's whatever you feel
comfortable with.

I would be uncomfortable because I'm afraid I might put a bug into the
service and have it appear on the server before I have a chance to
test it. I would create the web application on my local machine. After
writing some code and doing some testing, then I'd upload it to the
hosting provider.

--s

On 21 Jun 2004 17:51:09 -0700, jo********@hotmail.com (John) wrote:
Thanks for your posting.

I started Visual Studio and told it I wanted to create a new web
service. It asked for the URL and I gave the URL to my site (hosted by
a hosting company).

Is there something I should do to tell VS to not upload the cs files?
I really like that when I press CONTROL-ALT-B the solution is built
and uploaded to the server for me to test.

I see that the solution is stored locally. I kind of like this because
I can take the .sln file home with me and all the code is on the
hosting server so as long as I delete my VSWebCache directory I can
work on the code from both places. Is this a bad thing to be doing?

John

Scott Allen <bitmask@[nospam].fred.net> wrote in message news:<9q********************************@4ax.com>. ..
Are you using "Copy Project"? If so, you should see the option to copy
"Only the files needed to run the application", which won't put source
files on the server.

HTH,

--
Scott
http://www.OdeToCode.com

On 21 Jun 2004 08:50:40 -0700, jo********@hotmail.com (John) wrote:
>Hi,
>
>I'm building a web service which connects to a database. I have
>hardcoded the connection string in the web service source code (an
>asmx.cs file).
>
>Is this a mistake? Is there someplace else I should put the database
>connection string or just the password?
>
>BTW, is it a bad idea to leave .asmx.cs files on the web server? I
>don't think they need to be there for the app to function. I wonder
>why Visual Studio doesn't leave them on my local disk?
>
>Thanks,
>John


--
Scott
http://www.OdeToCode.com
Nov 18 '05 #6
Is there a way to tell Visual Studio to not put .cs and other
non-necessary files on the server when creating/compiling a web
application?

Thanks,
John

Scott Allen <bitmask@[nospam].fred.net> wrote in message news:<8i********************************@4ax.com>. ..
Hi John:

When you create the web service in this fashion there there is no way
to keep the source code files off the server. There is nothing
inherently wrong or bad about this approach - it's whatever you feel
comfortable with.

I started Visual Studio and told it I wanted to create a new web
service. It asked for the URL and I gave the URL to my site (hosted by
a hosting company).

Is there something I should do to tell VS to not upload the cs files?
I really like that when I press CONTROL-ALT-B the solution is built
and uploaded to the server for me to test.

I see that the solution is stored locally. I kind of like this because
I can take the .sln file home with me and all the code is on the
hosting server so as long as I delete my VSWebCache directory I can
work on the code from both places. Is this a bad thing to be doing?

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Florian Lindner | last post by:
Hello, I've a scripts that allows limited manipulation of a database to users. This script of course needs to save a password for the database connection. The users, on the other hand need read...
14
by: Miranda | last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The problem is I need to insert those passwords into an Access database of 327 clients. I have the random password program...
3
by: John Buchmann | last post by:
In my web.config, I have a section that has a name and password: <credentials passwordFormat="Clear"> <user name="aaa" password="bbb" /> </credentials> Is this secure? What is to stop...
1
by: PeterW | last post by:
On my machine I developed a WebService on localhost and if I browse the asmx file I get the usual page that defines the webmethods exposed by the webservice and the opportunity to get the wsdl file...
19
by: Cord-Heinrich Pahlmann | last post by:
Hi, I have written a tool wich de/encrypts a few of my forum and bloggin-Passwords. My question is how secure it is. The following describes how I have encrypted my passwords. When I log in,...
2
by: Steve B. | last post by:
Hi, We have build an ASP.Net 2.0 framework for our corporate sites. This framework add some asmx files that are used by all application. The asmx files only contains the directive <%@...
5
by: =?Utf-8?B?a3Jpcw==?= | last post by:
I created a simple webservice .asmx on Visual Studio 2005. As I plan to deploy it to Sharepoint Portal 2003, I copied asmx to \web server extensions\60\ISAPI directory of the server, where all...
0
by: dankyy1 | last post by:
hi ,i have an asp.net project runs on local intranet ,i use global.asax's onerror section to catch errors.so i got a simpleauth service does not exists error from some network clients .Error details...
2
by: Simon.Whiteside | last post by:
If someone has created a database for me and transferred it over is there any way that I can check I have full access to all areas? I am a beginner with Access and so the development has been...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.