473,406 Members | 2,336 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,406 software developers and data experts.

How to set the web.config ?



Hi ,

we r using c#.net and we r open the public IP to our web server,so that
our client from other country could easily log in and see the deatils.

For some security reasons,i need to restrict my client(ex :user
name:client1,domain=domain1) to access my public IP .all other outside
users except the one i specified above should be denied to access my web
server.
How to do this.

with thanks & regards
Raghu( a drop in the ocean)


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
6 1270
If you are talking about server access, simply setup user account in active
driectory.

If you are talking about website access look at the following:

Key elements here are the preload (At top), Submit_UNPW, the asp code within
the body, and the page_load routine on each page you wish to protect.
Login page
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>YourHomePage</title>
</head>

<Script Runat="server">

Sub Submit_UNPW(Sender as Object, E as EventArgs)
If page.isvalid then
Dim cnUsers as OleDbConnection
Dim daUsers as OleDbDataAdapter = New OleDbDataAdapter
Dim dsUsers as DataSet = New DataSet
Dim drUsers as System.Data.DataRowView
Dim dvUsers as DataView
Dim ConnectionString, SelectStatement as String

SelectStatement = "Select * From Users Where Username = '" &
tbUsername.Text & "' AND Password = '" & tbPassword.Text & "'"
cnUsers = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Inetpub\wwwroot\YourWebSite\fpdb\Users.m db")
daUsers.SelectCommand = New OleDbCommand(SelectStatement, cnUsers)
daUsers.Fill(dsUsers, "Users")
dvUsers = dsUsers.Tables("Users").DefaultView

'Check for Matching User
if dvUsers.count = 1 then
lError.Text = ""
drUsers=dvUsers.Item(0)
Session("UserID") = drUsers("ID")
Session("UserName") = drUsers("UserName")
Session("PassCode") = "valid"
Session("AccessCode") = drUsers("AccessCode")
Session("FirstName") = drUsers("FirstName")
Session("LastName") = drUsers("LastName")
response.redirect("staff_menu.aspx")
Else
lError.Text = "The Username and Password you have entered do not match
our records.<br>Please try again."
End If
End If
End Sub

</script>

<body stylesrc="../bg.htm" topmargin="0" leftmargin="0">
<form Runat="Server">

<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
collapse; border-right: 1px solid #000000" bordercolor="#111111" width="629"
background="../images/EmSB.jpg" height="100%">
<tr>
<td align="center" valign="top"><font face="Arial"
size="1">&nbsp;</font><font face="Arial" size="5"><b><br>
Please Login Below</b></font><p>&nbsp;</p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="300">
<tr>
<td width="150" align="right">
<p style="margin-right: 5"><b><font
face="Arial">Username:</font></b></td>
<td align="left" width="150"><b><font face="Arial">
<asp:TextBox ID="tbUsername" Columns="18" MaxLength="10"
runat="server"/>
<asp:RequiredFieldValidator ControlToValidate="tbUserName"
Display="Dynamic" Text="<br>Required Field" Runat="Server"/>
</font></b></td>
</tr>
<tr>
<td width="150" align="right">
<p style="margin-right: 5"><b><font
face="Arial">Password:</font></b></td>
<td align="left" width="150"><b><font face="Arial">
<asp:TextBox ID="tbPassword" Textmode="Password" Columns="20"
MaxLength="10" runat="server"/>
<asp:RequiredFieldValidator ControlToValidate="tbPassword"
Display="Dynamic" Text="<br>Required Field" Runat="Server"/>
</font></b></td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="300">
<tr>
<td><b><font face="Arial">&nbsp;</font></b></td>
</tr>
<tr>
<td align="center"><b><font face="Arial">
<asp:Button Text="Submit" OnClick="Submit_UNPW" Runat="Server"/>
</font></b></td>
</tr>
</table>
</center>
</div>
<p><font face="Arial" color="#FF0000">
<asp:Label ID="lError" Runat="Server"/><b>
</font></b>
<p>&nbsp;</td>
</tr>
</table>
</div>
</form>
</body>
</html>


Place this on each page you wish to protect.

<Script Runat="server">

Sub page_load(Sender as Object, E as EventArgs)
if NOT(Session("PassCode") = "valid") then
response.redirect("http://www.YourHomePage.com")
else
'Session("UserName")
'Session("AccessCode")
lFN.Text = Session("FirstName")
lLN.Text = Session("LastName")
end if
End Sub

</script>
"Raghu Raman" <ra************@rediffmail.com> wrote in message
news:eJ**************@TK2MSFTNGP11.phx.gbl...


Hi ,

we r using c#.net and we r open the public IP to our web server,so that
our client from other country could easily log in and see the deatils.

For some security reasons,i need to restrict my client(ex :user
name:client1,domain=domain1) to access my public IP .all other outside
users except the one i specified above should be denied to access my web
server.
How to do this.

with thanks & regards
Raghu( a drop in the ocean)


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #2
Don't allow anonymous access. Require a login to access the web site. And
for additional security, use HTTPS.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Raghu Raman" <ra************@rediffmail.com> wrote in message
news:eJ**************@TK2MSFTNGP11.phx.gbl...


Hi ,

we r using c#.net and we r open the public IP to our web server,so that
our client from other country could easily log in and see the deatils.

For some security reasons,i need to restrict my client(ex :user
name:client1,domain=domain1) to access my public IP .all other outside
users except the one i specified above should be denied to access my web
server.
How to do this.

with thanks & regards
Raghu( a drop in the ocean)


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #3
check here

http://support.microsoft.com/kb/815151

--
rajagopal

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #4
Hi,Mark

Your first line could be the solution to my probs.Because i want to
restrict other users to access my public Ip webserver.

i need to create the user a/c for the directory.
Thanks a lot


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5
HI , thanks for that.
but i need to protect my server having the Public IP .So first i should
go for the active user a/c. after that i can put the authorization a/c.
Since the intruders know the public IP , even they could copy our
folders.

So , we proceed with mark's view in this case

Thanks &regards
Raghu
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #6


Hi thanks . i ll see that

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #7

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

Similar topics

13
by: Maxim Khesin | last post by:
I want to have a config file with my python proggie, satisfying the following requirements: 1) support key->(value, default) 2) simple and intuitive to read and edit 3) easyly readable into a...
4
by: Fuzzyman | last post by:
There have been a couple of config file 'systems' announced recently, that focus on building more powerful and complex configuration files. ConfigObj is a module to enable you to much more *simply*...
3
by: Richard Lewis Haggard | last post by:
I have a test application that is calling an assembly that reads some strings out of a config file. Normally, this assembly supports a web application and the information can be read just fine....
13
by: Khodr | last post by:
Hello, I am using VS.NET 2003 and vb. I build my application MyApp and it generates MyApp.exe.config. So now MyApp.exe reads parameters from MyApp.exe.config. Great and no problem! I need to...
20
by: tomerfiliba | last post by:
hey i've been seeing lots of config-file-readers for python. be it ConfigObj (http://www.voidspace.org.uk/python/configobj.html) or the like. seems like a trend to me. i came to this conclusion...
11
by: TARUN | last post by:
Hello All I need to ask about the configuration file in .NET, There are Two config File 1. Web Config 2. Machine config I understand the the usage of Web config , but not able to understand...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
10
by: eagle | last post by:
I have a web.config in my application that contains the connection strings to all my datasources. I want to move these connection strings to another web config up the folder hierarchy so that all...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.