Detecting If Site Is Being Accessed By A Robot?
Feb 15, 2010I have some geo targeting code whcih I want to behave in a particular way if the site is being spidered by a robot e.g. google etc.
Is there any way to infer this?
I have some geo targeting code whcih I want to behave in a particular way if the site is being spidered by a robot e.g. google etc.
Is there any way to infer this?
When i'm sending an HttpWebrequest, I've this response:
"Go away, Robots are not supposed to visit this page"
What can I do for avoid this?
Is there a way how I can check programmatically which user is used when my application accesses resources?
I have a production system which only our admin can access. Sometimes it is not clear what part of the system is wrong: Lets say when logging is not working. It is always possible that the web.config is wrong, but sometimes the directory is not accessible. It would make my life easier if I could be sure, that the user is used, that I expected.
I have a Menu page. If a user selects an Menu Item it opens a new IE Window using JavaScript. So user can open different parts of applications in multiple IE Windows. These Windows have the same Session.
My issue is that these pages are accessed synchronously? If one of the child window is waiting for an action to be finished no other request from any other child window is processed. Is it because of using Session variables?
Update: This is only happening to the windows having the same parent. If I have IE child windows from different parent windows then this issue is not there.
There is a UserControlA which was already developed when I joined on a project. It is in a Project which I will call MyProjectWeb and it's namespace is MyProjectWeb.Common.
[code]....
But to my surprise, I cannot create an instance of UserControlB in the same code file in WorkFlowManager. MyProjectWeb.Common namespace does not even contain a UserControlB. When I compile I get obviously get a The type or namespace name 'UserControlB' does not exist in the namespace 'MyProjectWeb.Common' (are you missing an assembly reference?)
Why is that I can reference UserControlA but not UserControlB which are in the same namespace from the WorkFlowManager cs file? If I access the MyProjectWeb.Common namespace anywhere inside the MyProjectWeb, I can see both the user controls. Anywhere to look for errors?
i am using MVC for my project in the logon authentication, when i login using correct values there is no problem.
If i login using false or empty values i get the DataContext accessed after Dispose error.
i get it in the first line itself 'using (HealthObjectDataContext dc = DataContextFactory.GetDataContext())'
this is the method i use in the security service.
[code]....
I am running into an odd problem, and this is the only thing I can think of. I'm storing a list in cache, and I am randomly losing items from my list as users use the site. I have a class that is called that either goes to cache and returns the list from there, or if the cache is over a certain time frame old, it goes to the database and refreshes the cache. So when I pull the data from cache, this is what it looks like....
results = (List<Software>)cache["software"];
And then I return results and do some processing, filter for security, and eventually it winds up on the screen. For each Software record, there can be multiple resources attached to it, and based on how the security goes they may see some, all, or none of the records. So in the security check it will remove some of those resources from the software record.So my question is.... when I return my results list, is it a reference directly to the cache object? So when I remove a resource from the software object, it is really removing from cache as well? If that is the case, is there any way to not return it as a reference?
edit: I think I may have just answered my own question.... so if I do something like this:
results = new List<Software>((List<Software>)cache["software"]);
it will copy the cached list to my results list, correct?
I am thinking to create a web service for a SQLDB, I have created a simple database with two three tables tbldestination, tblflights and tblbooking.my big problem is how can i enable my database to be accessed through web service?
View 2 RepliesMy LogIn action originally looked like this:
return new RedirectResult(nameValueCollection["ReturnUrl"]);
But, I would like to know whether the client has JavaScript enabled before the home page loads, so I changed it to this:
return View(new LogInViewModel { ReturnUrl = nameValueCollection["ReturnUrl"] });
And send the following view instead of the instant-redirect:
@model Obr.Web.Models.LogInViewModel
@{
Layout = null;
string noJSReturnUrl = Model.ReturnUrl + (Model.ReturnUrl.Contains("?") ? "&" : "?") + "noJS=true";
}
<!doctype html>
<html>
<head>
<title>Loggin in...</title>
<meta http-equiv="REFRESH" content="1;url=@noJSReturnUrl">
<script type="text/javascript">
window.location = "@Model.ReturnUrl";
</script>
</head>
<body>
<noscript>
Loggin in...<br />
<a href="@noJSReturnUrl">Click here if you are not redirected promptly.</a>
</noscript>
</body>
</html>
The idea is that if the user does not have JavaScript enabled, they see a brief loading message, and the home page loads after a second. If JavaScript is enabled, the page reloads instantly. In the future I could even post to the server the dimensions of the viewport and such. Does this look like it would work? If the window.location command takes longer than a second to run, will it be interrupted by the meta refresh, or does it block that refresh? I am hoping the latter, so I don't need to increase the delay for those non-js people.
I figure my new way adds a little extra weight to the payload of the redirect, but it's not an extra round-trip or anything, is it? The redirect happens anyway, does it not? Update: I neglected to mention a very important point. I do not actually have control over the login screen itself, only the page it posts to. This code is part of a product that relies on an external authentication mechanism.
So I'd like to redirect mobile users to a different page. But instead of trying to detect any number of mobile browsers, I'd just like to see if the user is using IE, Firefox, Safari, Chrome, or Opera; all other users go to the mobile site. My biggest problem is detecting regular Safari from mobile Safari.
View 1 Repliesi'm programming an application where an action is done if i access with a version equal or higher than other and another action if i access with a lower version; but the problem is that the lines to indicate the versions doesn´t work. The code is the following:
[Code]....
As you can see, an action should be done if the version is the 9.0 or higher and other if it is lower, but these lines doesn't work and only works the detection of the web browsers (no the versions of them, action that doesn't works).
I'm developing an extra section to a web app that's written in asp.net, but in php - it's mostly done (the two parts don't really communicate with each other outside of a database - the integration is mostly just cosmetic.)
The only issue I have is detecting from the php part when the .net session has expired so that it logs the user out and redirects to the login page.
I believe the asp.net application is compiled, but either way I'm not allowed to alter it so I was thinking maybe the best thing to do would be to make a very small/simple aspx page that outputs true or false which I could call using curl from php (and passing the browser's cookies along.)
Would this even be possible? I'm not sure how session security works on asp.net eg whether one .net application can read another's session variables, but if it's anything like php then it'll be possible.
mypage.php --curl--> checksession.aspx --|
| |
<----------- true / false <---------------
So mypage issues a GET (with cookies from browser) to checksession using curl, checksession simply returns a true or false (or something like that) and mypage redirects to the site's login page if that's false.
The authentication for the php side is already sorted out and is separate to this issue.
So really, what I need to know is can I have just a simple .aspx file that does this check, and if so where would I go to to find out how to program such a simple page?
How to Host the Web Application on IIS 7.0 so that 100 people can be accessed locally.
Request you to provide steps on how to go ahead with it.
I am running a test page on a local server that I want only to be available to comouters that are running on the LAN. However, My web page can be accessed over the internet, how can i stop this?
The page is running on a Windows Server 2003 pc using IIS 6.0
is there any way to stop share the static variable at multiple users....I need to create a new insatnce of static variables or not accessing the same static variables across multiple who are using the same site.....while googling i found like hisSystem.Threading.Interlocked.Increment(ref MyClass.InstanceCounter); by using can I do....or is there any other way to stop accessing the static variables accross multiple instances of my site......and in my scenario i cannot use rely on session variable also
View 2 RepliesI am finding it quite awkward. I have registered the user controls and they are actually being parsed as I can view the controls I have placed on them. Problem is that I cannot access them in code behing. Even when I place them, their tags are not represented in the intellisence drop down. What could be causing this? I am placing them on a page residing in a master page setting. The controls are declared on the child page.
View 2 Repliesi have the following problem: i work in web application and only today. any control i put on the page, when trying to access it from behind code. it doesn't appear at all. what are the probabilities and reasons for this problem. note:i work from a thin client. they make some maintenance on their server today. and after that i find this problem.
the previous controls on my page can be accessed normally with out any problems.
how to make a method as global method so that i can call it anywhere in application without referring any class
namespace SomeNamespace
{
public static class SomeClass
{
public static string SomeMethod()
{
...
}
}
}
used methods:
1.string x = SomeNamespace.SomeClass.SomeMethod();
2.using SomeNamespace;
string x = SomeClass.SomeMethod();
What i Need is :
somemethod();
Is there a way to detect if the user closes the browser/popup page? I am trying to implement a chat functionality by when the user closes the browser/page, I will update the flag in the database from active to not active. But I cannot seem to find a better way to handle that besides from detecting if the user closes the page.
View 13 RepliesI'm working on an ASP.NET web application. There's a bill page which has two links to different pdfs of the same bill. When you click on one of the links it takes you to a ViewPDF.aspx page that shows the pdf. There's also an option to view both in a split screen so that you can compare them. When you click on this link it takes you to BillSplit.aspx which has a frameset and two frames that both point to ViewPDF.aspx. This all works perfectly.
The problem is that if an error occurs while pulling up the pdf. The application has an error page that has a few links back into the application. If you use one of these you can go back into the app and continue but now inside the frame. The URL still says BillSplit.aspx but the application is completely unaware of this since frames are HTML elements not asp.net controls.
What I would like to do at this point is detect that you've returned to the application and close the frame you aren't using. Essentially I'd like to redirect you away from BillSplit.aspx and to the page you're actually requesting. I'm pretty sure this would need to be done in Javascript either on the BillSplit page or on the pages that you go to later. So I guess what I'm asking is, is there a way to ensure that the BillSplit.aspx page and it's two frames point only at ViewPDF.aspx?
I recently started using fusioncharts (which is a great charting tool btw) but I releaized that although it renders Right to Left languages correctly, it does not display them from Right to Left, so if I have "Sales Report" in Arabic, it will be displayed "Report Sales" in the chart.
I dont have a problem with this with static text because I can reverse it before I send it to the chart, but with dynamic text that is entered by the user it is a challenge, because the user may enter the details in English or in Arabic, or in both.
So if I can define the character code used in the sentence then my problem will be solved, and the first thing that came to my mind in order to do this is:
- Take one letter from each word in the string and compare it with the Arabic alphabet (instr function).
- If the function returns true then the letter will be arabic and therefore the whole word will be arabic, I'll store this word in a new string
- If the next word is also Arabic I'll add it to the new string else I will skip it and start a new string for the next words to come.
- After I finish searching the string I will reverse the words in the new string and replace them with their parts in the old string then send them to the chart.
We are looking to create a website that displays information to all new visitors to a site, i.e. welcome,The big problem is that our website is not allowed to use long-lasting cookies (i.e. over 20 minutes). Does anybody know of any way we can determine whether a user has visited the site before or not. As another restriction, we can not add anyform of registration to the system. The application is being created in ASP.Net 3.5.
View 6 RepliesI have a web site which uses forms authentication and we have a log out page which will sign out the user and set that they are signed out in the database. This needs to be done as they use concurrent licences. The problem is that users are closing down the browers without logging out, meaning that the database shows them as logged in. I would use javascript onbeforeunload/unload functions to call a webservice, but this is unreliable to actually know if they have closed down the browser. or just hit refresh. An idea i had was to have a web service fired every 20 mins to detect if a user has loaded any pages within 20 mins, if they have not then to set them as logged out.
View 2 RepliesI have C# code I want to use in both a WinForms app and ASP.NET website. The database connection string differs for each though, so I want to be able to find out which platform it's running on and set the connection string appropriately. Is there an easy/recommended way to do this ?
View 3 RepliesAs per the requirement of my client I would like to create an application which detects content changes on the websites we provide. Like we will have an admin section where we add the websites we want to keep a track of. And on the other side it tell us of any new content on those websites. The websites will be kind of general news website and won't have RSS feeds. I would like to know if there is any way to do something like this. Any ideas are welcome. I would like to know just the logic how to create such a thing.
View 5 Replies