473,804 Members | 3,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1670
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********@hot mail.com> wrote in message
news:d8******** *************** ***@posting.goo gle.com...
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********@hotm ail.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********@hotm ail.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******* *******@TK2MSFT NGP12.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********@hot mail.com> wrote in message
news:d8******** *************** ***@posting.goo gle.com...
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********@hotm ail.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********@hotm ail.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
4304
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 permission on the script in order to execute it but should not be able to read out the password. What is the common way to solve this problem? My current way is to allow the users to execute the script with sudo while not having read permission...
14
4076
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 generating the 327 passwords, but have had no luck inserting them. =============================================== Here is the code that generates the passwords: =============================================== <% Option Explicit %>
3
16552
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 someone from opening up this file (it's a simple text file), getting the sensitive info, and then breaking into my site?
1
3309
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 using the Service Description link. This is saved into SourceSafe and then another person in the team gets latest from sourceSafe onto his system to try to run the webService on his localhost, all of the solution builds properly, but any...
19
2454
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, the Login-Password is changed into a md5-Hash and is compared to the login-password in the db. If the passwords are the same the use is logged in (common procedure). Then the clear-text
2
1677
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 <%@ WebService Language="C#" Class="OurFrameworkServiceClass" %> The class is defined in a dll (then w/o source code) that is place in the BIN directory.
5
70514
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 other general webservices reside. Everything is just fine - i can access the service with the browser, method list is displayed as well as help texts for them. my question is - how do I generate .wsdl and .disco files for the service? I read...
0
4374
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 are below.on my iis i have no virtual file such like this and nothing is installed like that. so what this error means? thanks. Error in: /SimpleAuthWebService/SimpleAuth.asmx Url: /SimpleAuthWebService/SimpleAuth.asmx Error Message: The...
2
2103
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 done by a temporary employee who has now handed the database over to me. Not that I think he is an untrustworthy character but I would sleep easier at night if I could check he has given me 100% of the database and three months down the line I am...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.