|
Does anyone know of a .NET solution to reading data from another website and updating data on that website? For example, there's a fantasy sports website that can read & display data about a persons "Yahoo!" fantasy sports team and send updates back to Yahoo. They also do this for about 20 other fantasy sports websites.
As you can see in this image (http://97.74.54.51/images/image1.jpg), they ask for your Yahoo account info. They then somehow retrieve your Yahoo data and display it onto their page (http://97.74.54.51/images/image2.jpg).
Does anyone know how this can be done or what programming methods I should be looking into to do this?
Thanks.
|
|
|
|
|
If they have your info, they can obviously log into your account. I'd assume there's a webservice interface they can use. The other option is screen scraping, they request a page, and then parse it for data.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Something like this[^]
only two letters away from being an asset
|
|
|
|
|
As CG Said, I think Web Service is the best option for it.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I am trying to create an ASP.NET app using C# in VS 2005. I have a number of fixed Panels in the HTML, that I dynamically populate with server controls as the user utilizes the application.
I have noticed that as I populate some of the panels dynamically, the controls render okay. But I do View Source in Internet Explorer and the generate HTML markup for the dynamically-generated controls is no where to be found in the source. However, they are there, rendered on the page.
Does that make sense? Shouldn't I always be able to see the generated HTML from ASP.NET?
Thanks,
Mark
|
|
|
|
|
If you are using normal html controls like div, input etc, it will be directly rendered as you made. The id of those controls might change sometimes.
On the other hand asp.net controls renders differently. The asp.net controls renders normal html with some javascript and css etc to handle them. For instance :
If you write
<asp:label> it will render it as <span>
This is because browser knows nothing other than HTML. So to work in Browsers the server side Handlers should render proper html.
Moreover if you are using Masterpage, the Id of each control will be placed in such a way that its name contains the ContentPlaceholder name. This is just to ensure that there is no ambiguity between Masterpage controls and Content page controls. You can get the id generated for each control in the server side by calling its ClientId.
Try to look carefully on your code.. .I think you will find them hidden somewhere.
|
|
|
|
|
Greetings,
I and my colleagues are developing a project in Visual Studio 2008 using ASP.Net C# language and we wanna share the same code-behind between 2 aspx pages. we found 2 methods to apply this:
1- Dealing with the page directive properties: change the "Inherits"
value to the base class.
2- Creating a common class: use it as base which other 2 pages inherit
from it and be considered as derived classes.
now, we're looking for using the best method to implement our goal, share code-behind between multiple aspx pages.
can anybody provide us with his experience in this?
your cooperation is highly appreciated.
Thanks.
|
|
|
|
|
|
Well, The best way I would recommend is the 2nd Option. Create a BasePage which inherits from Page class. Define your custom functions there. Now after creating your own page, just change its inheritence from Page to BasePage.
Place the BasePage to your App_Code folder so that any webform you create will have direct access to it.
|
|
|
|
|
Thank you all
sorry if my question is not clear enough. |:
To be more detailed:
In our project, we have a business and data layers. Each has a class with related methods and properties that can be accessed by any web form within the project.
What we're working on is:
Develop a bilingual system, create 2 pages for the same purpose but with different UI language. we're looking for using the same code-behind file for both of them but with a little difference which is in a Button Click event called "Back" that specify different 'Redirect' link.
we tried the the 2 methods mentioned above.
In the 1st option we considered one of the 2 pages class, which has all needed methods and properties in code-behind, as a base class of the other one, which has no methods.
e.g.
Project called: MyProject
page 1 called: Page_1.aspx
page 2 called: Page_2.aspx
Page_1.aspx.cs is a base class,
Page_2.aspx has the following page directive:
<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.Master" AutoEventWireup="true" CodeBehind="Page_2.aspx.cs" Inherits="Page_1.MyProject" %>
Now, I need to know which option is the best in our case?
One more question:
while using the 2ed option, create a base class, we need to define some aspx page controls within the code to be accessed by any methods in the base class. we faced a problem when tring to declare them as a class data member?!
Note: we use a master page, so the controls in aspx pages are placed in a content holder
and because of this we use the following declaration statement:
Label Label1 = (Label)this.Master.FindControl("ContentPlaceHolder1").FindControl("Label1");
the error occured when using 'this': "keyword 'this' is not available in the current context"
any suggestions please?
Thanks again. <=
modified on Sunday, September 27, 2009 8:38 AM
|
|
|
|
|
Hello,
Did you success sharing the same code behind between many pages?
I'm doing the same thing between ascx controls.
Thanks for sharing your experience!
Nicolas
|
|
|
|
|
Hi Nicolas,
Yes, we use the 2ed option which is create a base class includes all common methods, and the web forms inherits from it instead of Page class System.Web.UI.Page as following:
Page1 & Page2 are web forms,
Base is class,
in Page1 [the same in Page2] code-behind:
public partial class Page1 : Base
in Base class:
public partial class Base : System.Web.UI.Page
Hope this helps.____________
Tfaol
|
|
|
|
|
Hi,
How to declare variable globally so that i can use in entire my C# class. Please help me.
|
|
|
|
|
|
Hi,
I am working ASP.Net 3.5. I am not able to create App_Code folder. There is no option for the App_Code folder.
|
|
|
|
|
srikantha_nagaraj wrote: I am working ASP.Net 3.5. I am not able to create App_Code folder. There is no option for the App_Code folder
Did you check the link that I have provided to you. On that article I have mention how to create the App_Code Folder. There is nothing to do with ASP.NET Version.
On Solution Explorer > Right Click > Add ASP.NET Folder > App_Code . Thats All
Again, Please check the link that I have provided to you on last post.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Actually i am using web application to create my project not website as you have used in your article. But how can i do same in the web application? I have to have variable which will have counter of times i am inserting it to table.
|
|
|
|
|
srikantha_nagaraj wrote: Actually i am using web application to create my project not website as you have used in your article.
You didn't mentioned it earlier.
Have a look,
app_code folder in web application[^]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Are you talking about variables that every session can access ?
If so then why not you use Application object.
From your code :
Applicatiion["yourvariablename"] = value ;
Now this value will be available globally to every session. Call this value using :
object val = Application["yourvariablename"];
|
|
|
|
|
It was quite clear that the OP wasn't talking about session or application variables. Abhijit Jana already answered correctly about three hour before you. You should try reading the previous responses and going for quality rather than quantity in your responses.
only two letters away from being an asset
|
|
|
|
|
I think this is wrong.. .
Just see the response next to you, and see actually the user wanted my solution.
We are here to give as many solutions as we can for each posts (so that the base gets enriched and others in future can get reference to it...) rather than to blame each others.
If you see all my responses here in ASP.NET, you will see, I take lots of time to answer each post. I dont post just to increase my post counts.
If you check all my responses, you can see my replies got less no of one liners...
|
|
|
|
|
I am not able to create Application variable. I am unable to create appication or session variables. Please help me. I am facing some issues with that.
|
|
|
|
|
It seems that you are not clear about what you are going to do. I will suggest you to Buy some beginners ASP.NET Books and start reading. This will help you to longer run. As you are confusing with Classes and Session/Application Variable.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
You can use the following to create a variable name.
this.Request.Application["name"] = "This is my application";
To get the Name variable use
string s = this.Request.Application["name"].ToString();
If you are outside the page use
HttpContext.Current.Request.Application["name"]
instead.
|
|
|
|
|
Hi there,
I had a project which is running on web server.In that
I had memu tree.On click of menu item I want to open page which is present in admin folder.But when I click on menu item I get following error.But if I place that page in root directory then that page opens after clicking on menu tree.Can anybody knows what is the reason.
Server Error in '/' Application.
Cannot use a leading .. to exit above the top directory.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Cannot use a leading .. to exit above the top directory.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
System.Web.Util.UrlPath.ReduceVirtualPath(String path) +8855207
System.Web.Util.UrlPath.Reduce(String path) +52
System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +214
System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +180
System.Web.UI.WebControls.Panel.AddAttributesToRender(HtmlTextWriter writer) +8625143
System.Web.UI.WebControls.Panel.RenderBeginTag(HtmlTextWriter writer) +21
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +20
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
Life Is Beautiful
|
|
|
|