|
I’m developing a .NET/C# application software for an instrument which has a built-in PC (Core 2 CPU/2.66GZ/4GB RAM) and will have access to the Internet from behind the facility IT firewall. To support remote device maintenance via Intetnet using browser, I want to run a web site locally IIS hosted on the instrument PC. Apparently, this site is for authorized user only (could be anywhere on the Inernet). I know security is the major problem to deal with in this scenario. To reduce the surface of attach, can I lock down the allowable IP range to just one IP address where the service user is? This one IP address will be made configurable. Is this a viable approach to secure the web site with the least cost?
Just googled that .htaccess file can be created in webroot to block IP ranges. Will this still allow scripts to access the site
Sorry, .htaccess is available on Apache server only. What's equivalent on IIS?
modified on Saturday, June 19, 2010 10:19 PM
|
|
|
|
|
From IIS Manager; (This sequence is 2003 Server, but dare say others are similiar)
1) Right Click the Web Site and choose Properties
2) Select the Directory Security Tab
3) Click Edit in the IP Address and Domanin Name restrictions panel
4) Grant/Deny relevant domains/ip as required.
|
|
|
|
|
Is it possible to do it in code? e.g. after receiving an allowable IP address, place it somewhere in a config file?
|
|
|
|
|
Yeah, it's possible to do in code using WMI, you can read here[^] how to do it. You should change binding for the application.
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
|
I was recently going through one site and the url of that site was www.abc.com/default.asp
But that site was quite techy - so it can't be of that old asp days. Shouldn't it be .aspx in the end ? Or am i missing something.
Thank You
Andyyy
|
|
|
|
|
If they are hosting the site on their own server (or at least a server to which they have full admin access) then they could map asp files to .net - this is a simple setting in IIS. (Though one has to wonder why anyone would want to do this.)
But otherwise, there are still a lot of sites out there still in clasic asp. "If it ain't broke, don't fix it" is a good maxim in any field. Sometimes the work, time and money involved in upgrading a site is more than it's worth.
|
|
|
|
|
Hi All! I am trying to process several requests to a website, performing posts of data and processing page results. I'm finding it seems very inefficient, and actually it seems to take longer to process the request than compared to typing in manually.
Looking at the code below it appears there isn't a way to simplify or move initialization of objects to another method, rather than performing it each request is made (the requests are being made to the same website).
Here is my code below.
Thanks for all your help!
private string ProcessFormPOST(string strURL, string strFormData)
{
try
{
byte[] buffer = Encoding.UTF8.GetBytes(strFormData);
string proxy = null;
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strURL);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = buffer.Length;
req.Proxy = new System.Net.WebProxy(proxy, true);
req.CookieContainer = new System.Net.CookieContainer();
System.IO.Stream reqst = req.GetRequestStream();
reqst.Write(buffer, 0, buffer.Length);
reqst.Close();
System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)req.GetResponse();
System.IO.Stream resst = res.GetResponseStream();
System.IO.StreamReader sr = new System.IO.StreamReader(resst);
return sr.ReadToEnd();
}
catch (Exception ex)
{
throw ex;
}
}
|
|
|
|
|
Hi you experts, I want to write a Googlemap than UserControl so that the
Control may often be involved in a Page.
Lattitude, Longtiude should be enter. Creates should be a Linkbutton activated
a ModalPopup in which the inside is GoogleMap
What do you think? Do you have other ideas?
|
|
|
|
|
There are various controls already available for this just search for "Google Maps ASP control", here is one example returned; http://en.googlemaps.subgurim.net/[^]
You could also roll your own, if you look at the googlemaps api (Search google for the api site link) everything looks pretty straight forward.
There are also a couple of Articles on CodeProject that relate to google maps.
You could also use Bing Maps and likewise there is also a bunch of stuff already out there for it.
Cheers,
|
|
|
|
|
|
As with anything on the net, you have to read the relevant license to see if you can freely use it.
There is usually a terms of use / license quoted somewhere. All the articles on CP should have the license referenced at the bottom.
|
|
|
|
|
I am developing an asp.net data driven application using VS2010. Whenever I use the debugger and try to visualise a data table i am getting a function evaluation timeout error. My application is targeted for .NET 2.0.
Anyone came across this issue?
Thanks and regards,
Chris
|
|
|
|
|
Hi
Can I put a hyperlink on my web page and make it open at a random page?
|
|
|
|
|
You can't just get any random page existing in the universe, there is no way of generating the URL of a page randomly, however you can use a random index into a list of candidate pages.
Example: my articles[^] page, which gets generated from a database table, has a "random article" key which basically chooses a random row of that table.
|
|
|
|
|
Hi All,
Can i set a session value in javascript File and access it from code behind file in asp.net and C#
Thanks,
Amit
|
|
|
|
|
Amit Patel1985 wrote: Can i set a session value in javascript File and access it from code behind file in asp.net and C#
No, you cannot set a session in JavaScript. Sessions are server side and JavaScript is fully client side.
|
|
|
|
|
Its not possible, but you can have a workaround for this, store the value in a hidden field using javascript and add the hidden field value to session at server side.
WWW, WCF, WWF, WPF, WFC .... WTF
|
|
|
|
|
protected void _bindTopicPage()
{
int _lowerLimit = _pageIndex * _pageCount;
int _upperLimit = (_pageIndex * _pageCount) + (_pageCount - 1);
string _str;
if (Convert.ToInt32(Request.QueryString["UserID"]) != 0)
{
_str = "SELECT dbo.tblUser.FirstName, dbo.tblUserMessage.SubmittedOn, dbo.tblUserProfile.UserID, dbo.tblUserProfile.ImageUrl, dbo.tblUserMessage.Message FROM dbo.tblUser INNER JOIN dbo.tblUserMessage ON dbo.tblUser.ID = dbo.tblUserMessage.MessageFrom INNER JOIN dbo.tblUserProfile ON dbo.tblUserMessage.MessageFrom = dbo.tblUserProfile.UserID where dbo.tblUserMessage.MessageTo=" + Convert.ToInt32(Request.QueryString["UserID"]) + " order by [tblUserMessage].ID desc";
}
else
{
_str = "SELECT dbo.tblUser.FirstName, dbo.tblUserMessage.SubmittedOn, dbo.tblUserProfile.UserID, dbo.tblUserProfile.ImageUrl, dbo.tblUserMessage.Message FROM dbo.tblUser INNER JOIN dbo.tblUserMessage ON dbo.tblUser.ID = dbo.tblUserMessage.MessageFrom INNER JOIN dbo.tblUserProfile ON dbo.tblUserMessage.MessageFrom = dbo.tblUserProfile.UserID where dbo.tblUserMessage.MessageTo=" + Convert.ToInt32(Session["UserID"]) + " order by [tblUserMessage].ID desc";
}
SqlDataAdapter da = new SqlDataAdapter(_str, con);
DataSet ds = new DataSet();
da.Fill(ds);
StringBuilder _sb = new StringBuilder();
int _count = ds.Tables[0].Rows.Count;
ViewState["_cccount"] = ds.Tables[0].Rows.Count;
if (_upperLimit >= _count)
_upperLimit = _count - 1;
for (int i = _lowerLimit; i <= _upperLimit; i++)
{
_sb.Append("<div class='scrapGrayBg'>");
_sb.Append("<div class='scrapUser'><a href='Userprofile.aspx?UserID=" + ds.Tables[0].Rows[i]["UserID"] + "'><img src='cropimages/" + ds.Tables[0].Rows[i]["ImageUrl"] + "' width='50px' height='50px' alt='' class='imgBdr' /></a><br /><input name='' id='chk"+i+"' runat='server' type='checkbox' class='scrapCheck' value='' /></div>");
_sb.Append("<div class='scrapRt'>");
_sb.Append("<div class='scrapHdSce'>");
_sb.Append("<div class='scrapHd'><a href='Userprofile.aspx?UserID=" + ds.Tables[0].Rows[i]["UserID"] + "'>" + ds.Tables[0].Rows[i]["FirstName"] + ":</a></div>");
_sb.Append("<div class='scrapDelet'>" + ShowDateTime(ds.Tables[0].Rows[i]["SubmittedOn"]) + "<a href='#'><img src='images/delete_sml.gif' alt='' width='43' height='19' class='scrapDelImg' /></a></div>");
_sb.Append("<div class='clear'></div>");
_sb.Append("</div>");
_sb.Append("<div>" + ds.Tables[0].Rows[i]["Message"] + "</div>");
_sb.Append("<div><a href='javascript://' onclick='showText("v" + (i + 1) + "")'><img src='images/reply_sml.gif' alt='' width='50' height='18' class='replyBtn'/></a><br />");
_sb.Append("<div class='replyInpBdr' id='v" + (i + 1) + "' style='display:none;'><textarea name='' id='txtpostreply" + i + "' runat='server' cols='' rows='' class='replyTextArea'></textarea><br />");
_sb.Append("<div class='fl'><a href='javascript:fnAccept(" + ds.Tables[0].Rows[i]["UserID"] + "," + Convert.ToInt32(Session["UserID"]) + "," + i + ")'><img src='images/post_scrap.jpg' alt='' vspace='5' align='top' /></a></div>");
_sb.Append("<div class='fr'><a href='javascript://' onclick='hideText("v" + (i + 1) + "")'><img src='images/close_btn.gif' alt='' vspace='5' /></a></div>");
_sb.Append("<div class='clear'></div>");
_sb.Append("</div>");
_sb.Append("<div class='replyInpBdr' id='divmsg" + (i + 1) + "' style='display:none; color:#FF0000; margin:5px 0 0 0;'> Your message has been send successfully.");
_sb.Append("</div>");
_sb.Append("</div>");
_sb.Append("</div>");
_sb.Append("<div class='clear'></div>");
_sb.Append("</div>");
}
divdetail.InnerHtml = _sb.ToString();
_sb.Remove(0, _sb.Length);
int NoOfPage = _count / 8;
if (_count % 8 != 0)
NoOfPage = NoOfPage + 1;
_sb.Append("<div class='bradcrum' style='padding:4px;'>");
for (int j = 0; j < NoOfPage; j++)
{
if (j == Convert.ToInt32(Request.QueryString["PageNo"]))
_sb.Append("<a href='Scrap.aspx?PageNo=" + j + "' class='sel'>" + (j + 1) + "</a>");
else
_sb.Append("<a href='Scrap.aspx?PageNo=" + j + "'>" + (j + 1) + "</a>");
}
_sb.Append("</div>");
divPagenation.InnerHtml = _sb.ToString();
}
I am taking a input type checkbox.we want checkbox id's on button click.
i am using no control only use div.
I have used this
CheckBox chk = (CheckBox)page.FindControl("chk0");
it showing null.
so please help me????
|
|
|
|
|
rummer wrote: CheckBox chk = (CheckBox)page.FindControl("chk0");
it showing null
Have you given runat="server" to the checkbox you are trying to use? If it's a html checkbox then you need to give runat="server" and then caste it into HtmlCheckbox instead of just Checkbox.
If this does not resolves it then post your aspx page where you have this checkbox.
|
|
|
|
|
I wish to do an ecommerce site in which I am only going to include paypal payout functionality.
and I dont wish to add credit card processing.
Is this a serious problem to an ecommerce site, that I am using only paypal payout?
|
|
|
|
|
Gjm wrote: Is this a serious problem to an ecommerce site
Serious problem? difficult to say. It's about how flexible you are making your website for users. It's about user preference. So we cannot use term serious here instead it should be little 'limited'.
|
|
|
|
|
hi iam using asp.net with c#
i want to check through coding is procedure already exists in database or not
can you give example which helps me
|
|
|
|
|
IF EXISTS(SELECT name FROM sysobjects WHERE name = 'yourspname' AND type = 'P')
DROP PROCEDURE yourspname
CREATE PROCUEDURE
.
.
.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Hi,
I am wondering, how I can enforce a http response code with Routing ? I am using ASP.NET Web Form 4.0.
So far I understand, routes are using Http code 200 all the time. Can I override this code ever ? Or, if I place http status code response in my Page's Init or Load event, will that override that '200 ok' ?
For example, I have the following route,
routes.MapPageRoute("404", "{*url}", "~/Page-Not-Found.aspx");
I want to issue Http code 404 for this routing instead of 200.
Please help.
|
|
|
|