PDA

View Full Version : باز نشدن یک سایت



leonpersian
جمعه 22 دی 1391, 23:59 عصر
دوستان این مشکل و مدتهاست دارم اما هیچ برنامه نویسی نمیتونه حلش کنه
می خوام آدرس سایت وارد شده کاربر تو TextBox با زدن button مسدود بشه
یعنی باز نشه.

مثلا:
نوشت: http://www.google.com
و زدن button
دیگه گوگل باز نشه

RED-C0DE
شنبه 23 دی 1391, 12:01 عصر
پروژه در چ مورد هست کلا؟

خیلیا اینکارو انجام دادن گوگل می کردید می دیدید
با تغییر فایل hosts ک در مسیر c:\windows\system32\drivers\etc\hosts هست ، می تونین این کار رو انجام بدین (ک البته نیاز ب مجود admin دارین)

مثلا برای تست خودتون ابتدا برنامه ی notepad رو با مجوز ادمین باز کنید (چون برای ذخیره فایل hosts نیاز ب مجوز ادمین دارین) و این فایل رو توش open کنید . مثلا همچین ساختاری خواهد داشت :



# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost



حالا آدرس سایت مورد نظر برای block شدن (در واقع اتفاق دیکه ای می افته نه اینکه block بشه) رو ب آخر اضافه کنید:


# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
127.0.0.1 www.google.com

فایل رو ذخیره کنید (اگه با مجوز ادمین باز نکرده باشید اینجا خطا می ده)

حالا در command prompt (run ~> cmd) دستور زیر رو بزنید تا cache dns روی سیستمتون پاک بشه و مرورگرتون رو ببندید:


C:\Users\RED-C0DE>ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.



حالا www.google.com رو باز کنید
ب زبان ساده هنگام dns lookup ابتدا سیستم جاری رو و فایل hosts رو می گرده تا این ادرس اگه توش بود ب معادل ip تبدیلش کنه و اگه نبود یک مرحله بالاتر (isp) و الی اخر... حالا اینجا بهش گفتین ک ادرس www.google.com ~> 127.0.0.1 هست که همچین دامینی در این سیستم (host) ثبت نشده!

RED-C0DE
شنبه 23 دی 1391, 12:02 عصر
همین کارا رو داخل C# پیاده کنید

leonpersian
دوشنبه 09 بهمن 1391, 22:06 عصر
میشه C# شو بگید به زبان ساده