someoneelse 0 Newbie Poster

the error is "CS0246: The type or namespace name 'WebClient' could not be found (are you missing a using directive or an assembly reference?)". and I
am using all of the following:

using System;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.IO;
using System.Web;
using System.Web.Services;
using System.Web;
using System.Web.UI;
using System.Net.WebClient;

What is the syntax for HttpClient because when I try to add it is says it is wrong or not an object...

I just need a working exampke of a screen scrape in c# so i can pull info of one page and inlcude it in mine...

someoneelse 0 Newbie Poster

any ideas?

someoneelse 0 Newbie Poster

at this point i have:

using System;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.IO;
using System.Web;
using System.Web.Services;
using System.Web;
using System.Web.UI;
using System.Net.WebClient;

so using System.Net; is in there but still not working on this line:
WebClient client = new WebClient ();

someoneelse 0 Newbie Poster

using System.Net.WebClient; this didnt help me either.. I'm still getting the "CS0246: The type or namespace name 'WebClient' could not be found (are you missing a using directive or an assembly reference?)" error...

someoneelse 0 Newbie Poster

so, now i get an error that says : CS0246: The type or namespace name 'WebClient' could not be found (are you missing a using directive or an assembly reference?)

I tried adding

using System.Net.Http;
and System.Net.HttpClient;

but none of those are working.. what do i need to add?

someoneelse 0 Newbie Poster

yes, that is exactly what i want to do, but only in c#

someoneelse 0 Newbie Poster

I need help with .net c# screen scrape. I can't seem to find an example in c# that works. I have this one in VB that wors but feel like an idiot bc I can't convert it correctly...

<%@ Import Namespace="System.Net" %> <script language="VB" runat="server">

  Sub Page_Load(sender as Object, e as EventArgs)
    'STEP 1: Create a WebClient instance
    Dim objWebClient as New WebClient()


    'STEP 2: Call the DownloadedData method
  '  Const strURL as String = "http://www.aspmessageboard.com/"
 Const strURL as String = "http://www.expedia.com/Hotel-Search?#&destination=Helen, Georgia, United States of America&startDate=04/27/2015&endDate=04/30/2015®ionId=6057994&adults=2"
'  Const strURL as String = "http://www.grouphousingadmin.com"
    Dim aRequestedHTML() as Byte

    aRequestedHTML = objWebClient.DownloadData(strURL)

    'STEP 3: Convert the Byte array into a String
    Dim objUTF8 as New UTF8Encoding()
    Dim strRequestedHTML as String
    strRequestedHTML = objUTF8.GetString(aRequestedHTML)


    'WE'RE DONE! - display the string
    lblHTMLOutput.Text = strRequestedHTML
  End Sub
</script> <html> <body> <h1>Screen Scrape of www.aspmessageboard.com</h1> <p> <asp:label id="lblHTMLOutput" runat="server" />
someoneelse 0 Newbie Poster

it does :) ty for help

someoneelse 0 Newbie Poster

ahh, i got it. TY

someoneelse 0 Newbie Poster

but i need to set the value based on the returned value of the var pt.TOString()...

based on a value, i need to charge either 10, 20, 30, 40, 50 etc.

so i need an IF ELSE statement to determine the amount to be charged before i pass values off the the ecommerce api

someoneelse 0 Newbie Poster

I have a (probably stupid) question I hope someone can help me with.. So, I set a variaible beased on a form in put in the code behind, but then, a few lines down when I go to call it , it has a undefinded value. I don't understand.. Below is the code: The problem is that when i try to reference theamount on the line I marked "PROBLEM HERE" is that when I call the API, the value for theamount is undefinded.. even though it should have a value, and does above...

please help if you can... right now i have 5 if statements with the code in all, when i only need one and the amt value set above it... ERGH...

using System;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.IO;

public partial class SendMail : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
    if (IsPostBack)
    {
        Response.Write("<br>Page has been posted back.");

        //send payment info to api, send them an email, go to thank you page

            var ccex = Request.Form["ExpMon"] + Request.Form["ExpYear"];    
            var date1 = System.DateTime.Now.ToString();
            var pt = Request.Form["plantype"];

            Response.Write("<BR>ccex = " + ccex);        

            Response.Write("pt.ToString() = " + pt.ToString());
            if (pt.ToString() == "Gold")            
            { 
            var theamount = "150.10";
            }
            else
            {
            var theamount = "205.08";
            }

            String post_url = "XXX/transact.dll";           
                    Dictionary<string, string> post_values = 
                                new Dictionary<string, string>();

                                post_values.Add("x_login", "XXX");
                                post_values.Add("x_tran_key", "XXX");
                                post_values.Add("x_delim_data", "TRUE");
                                post_values.Add("x_delim_char", "|");
                                post_values.Add("x_relay_response", "FALSE");

                                post_values.Add("x_type", "AUTH_CAPTURE");
                                post_values.Add("x_method", "CC");
                                post_values.Add("x_card_num", Request.Form["ccnum"]);
                                post_values.Add("x_exp_date", ccex);

    PROBLEM HERE                            post_values.Add("x_amount", …
someoneelse 0 Newbie Poster

they are on the same server... but whenever i try to change to change the datbase name from Database1.dbo.Table1 it says invalid object name.

someoneelse 0 Newbie Poster

i am trying to figure out the syntax to do a SQL inner join from 2 different databases...

The sameple code looks like this: select *
from database1.dbo.table1 t1 join database2.dbo.table2 t2 on
t1.field1 = t2.field2

but I dont know how to refernce the " database1.dbo" and "database2.dbo" parts.. can someone help?

i know the table names in all my databases.. i have the connections in include files..

i just dont see how to "call" the other database? basically what i to know is what need to change dqatabase1, database 2, and dbo to in my code?

someoneelse 0 Newbie Poster

I am hoping there is a way to add OnChange to a .NET Label tag. the label is already part of an extensive form, I just want to be able to call a javascript function (to check the string for hyphens) when the text in the label changes. Can this be done?

someoneelse 0 Newbie Poster

I apparen;ty jumped the gun. The problem I have (and this is with and without the dynamic setting for the paging) is as follows:

I have a strange issue. I have a GridView that displays partial data from a table. When you click the "Select" button, I have a form view that shows the entire record. I have paging set to 5. Everything works fine when I view the first set of records. The problem is, when I click the 2nd page, or 3rd, or 4th page, and then click the "Select", it is showing me the first pages records. IE, the gridview is showing in alphabetical order, and when I am on page 10 looking at the T's, and click select, i see the first record, for "A". when I click the second record, I see "A" as well.

No matter what page I am on, it is only using the values from the first view for the select buttons (- I really hope that makes sense...)

someoneelse 0 Newbie Poster

I have a detail view that is displaying information from a table called demos. I am currently displaying a hyperlink so that someone can click the link and go a page (intense, I know!)

I would like to make the hyperlink go to different pages based on the value of one of the fields in the details view. For instance, I have a field called "listenedto". if the value is "yes", I want the link to go to "yespage.aspx" and if the value is "no", go to "nopage.aspx".

I am just unsure of how to accomplish this inside of visual web developer express...

someoneelse 0 Newbie Poster

THANKS SO MUCH!

I was able to get this to work with the code snippet you provided!

someoneelse 0 Newbie Poster

I would like to highly customize my detail view.

For instance, it is pulling info from a table, and one field in the table is cateogoryID. This relates back to another table where all the cateorgy types are declared. (Main table is demos, and then there is a table called Cats, where it should cross refernce the number it gets in demos to the ID field in the table Cats).

How can i accomplish this inside visual developer express? Or, how can i accomplish it when I click the view source button and manually edit the code?

someoneelse 0 Newbie Poster

is there a way to set a set a dynamic page size for gridview?

for instance, i am choosing 10 from the properites window for PageSize, but I would like to have a form field on the page where the user can type the number of records they would like to show per page, and have the gridview reflect that...

someoneelse 0 Newbie Poster

I am trying to implement an example of the built in login and createuser wizard. the ony problem is, (and this may be really retarded of me) is that when i publish it out to a web server it doesn't work. Of course, it works perfect locally.

Does the aspnetdb.mdf that runs on my computer not run on the real server?

Ideally, I want this to run off a remote SQL database, but I am not sure how to set that up... I see in the help and online that I am aupposed to be able to slect another source to store this data on the "Provider" tab, but I don't see that optoin.

When I click the ASP.NET Configuration Tool all i can see on the page for my optoins are:
--------------------------------
Use this page to select a provider for each feature.

Membership Provider
AspNetSqlMembershipProvider -CHECKED


Role Provider
AspNetSqlRoleProvider -CHECKED
AspNetWindowsTokenRoleProvider

-------------------------------------
So, I'd like to know the answer to 2 questions:
1-Can the aspnetdb.mdf that runs on my computer run on the real server?
2-how can I convert this to use a remote SQL database, ie, I can't see where to set the datasource as I do in the drigeview, detailsview etc portions of the visual web devloper express program...

Thanks For Your Help!

Andrea

someoneelse 0 Newbie Poster

THANK YOU SO MUCH!

I was going crazy and that solved my problem in less than 1 minute ;)

~ Andrea

someoneelse 0 Newbie Poster

I am using visual devloper express, and i have been following allow in the "starter videos". for lesson 8 (editing and insterting into a sql express db file on the local host), the example worked fine, but when i try to replicate the example with a SQL database (external one) when I am configuring the formView, and i try to click the advanced tab under 'Advanced SQL Generation Options", I do not have the abilty to check the 2 boxes for generate insert, update, delete statements, etc (they are greyed out).

i have an asp page that has the same connection as this page and i am able to insert a record, so i am sure it's not a permission thing...

does anyone else know how to solve this problem, or has it occured for someone else? I am at a loss....I don't understand what I am doing wrong here... a plain old asp coded page inserts records into this table in the same database, but I am unable to check the boxes for "generate insert" etrc, and the error I get on the page itself is

Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.



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.NotSupportedException: Inserting is not supported by data source …

someoneelse 0 Newbie Poster

I hope someone can helkp me. This is driving me nuts. I have the following code that produces this error " Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'selfmadeBrowser'."

The entire code is as follows
(please note, this script came DIRECTLY off of http://www.expertrating.com/courseware/DotNetCourse/DotNet-ASP.Net-4-3.asp,

I also am able to cnnect to this same Mysql database through other pages, but I am only able to connect, I can't edit or delete, stangely enough I can insert, but I have the same connection for all of them. I just need to know why this page gives me the user login failed, when i use the same user/password for the other pages and they work - partially....

<%@ Page language="VB" Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %> 
<html>
<head>
 <title>Untitled</title>
</head>
<body>

<% 
Dim dbConn As SqlConnection 
Dim sqlComm As SqlCommand 
Dim dbReader As SqlDataReader 
dbConn = New SqlConnection( "Server=localhost;uid=selfmadeBrowser;pwd=bpass;database=cacdb" ) 
dbConn.Open() 
sqlComm = New SqlCommand( "Select * From users", dbConn ) 
dbReader = sqlComm.ExecuteReader() 
While dbReader.Read() 
Response.Write(“<li>" ) 
Response.Write(dbReader( "Name" ) ) 
End While 
dbReader.Close() 
dbConn.Close() 
%> 
 
</body>
</html>

Basically, the end result is I need to be able to connect, edit, update, delete and insert into a MySQL database.

Also, it might be worth it to mention, I am not using Visual Developer 2005 YET, i am trying to learn the hand coding method first.

PLease, any help is GREATLY appreciated....

ps, this is the code for the MY SQL …

someoneelse 0 Newbie Poster

I am trying to implement a pop up control, but so far, all the examples I found seem to be a 3rd party application. Is this so, or shoul dI be able to find one?

Does anyone have an example of a pop up control, preferrably moveable (like drag and drop)?

Thank you :)
~Andrea

someoneelse 0 Newbie Poster

:sad:
I am trying to connect to a mysql database. ideally, i'd like it dumped into a grid view so i can edit it... no matter how i try it, i get this error-

Compiler Error Message: BC30002: Type 'ODBCConnection' is not defined.
here is the code for this page:

<%@ page language="VB" Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Microsoft.Data.Odbc" %>
<HTML>
<HEAD>
<SCRIPT Language="VBScript" Runat="server">
Sub Page_Load(Source as object, e as EventArgs)
Dim sConnection = "DRIVER={MySQL ODBC 3.51 Driver};" _ 
& "SERVER=localhost;" _ 
& "DATABASE=db;" _ 
& "UID=BrowserName;" _ 
& "PWD=bfakepass;" _ 
& "OPTION=3" 
'& 1 + 2 + 8 + 32 + 2048 + 16384 
Dim oConnection as ODBCConnection = new ODBCConnection(sConnection)
Dim sSQL as String = "SELECT FirstName, LastName FROM addresses"
Dim oDataAdapter as ODBCDataAdapter = New ODBCDataAdapter(sSQL, oConnection)
Dim oDataSet as DataSet = new DataSet()
oDataAdapter.Fill(oDataSet)
oDataGrid.DataSource = oDataSet
oDataGrid.DataBind()
End Sub
</SCRIPT >
</HEAD>
<BODY>
<ASP:DataGrid ID="oDataGrid" Runat="server" />
</BODY>
</HTML>
someoneelse 0 Newbie Poster

I am not using VS2005. I am basically using Notepad, well, ok, an HTML editor....

so, I appreciate the help f1 fan, but it really didn't do too much for me :) i just need a straight up example of asp.net form and inserting the results into a db, preferabbly SQL :)

someoneelse 0 Newbie Poster

I am new to ASP.net as of today :)

I have jumped many hunrdles alreday, writing/deleting text files, connecting to a db, sendiong emails, yeah me.

I am looking for 1 concise example to show how i can take the contents of a form and insert them into a datbase. i am having the worst time trying to find a tutorial or example that explains this is a way that makes sense and that also works.

please, can someone help me?

i just need a straight up form that has like name, last name, phjone and emial, that can store it into a database - right now im using a MYSQL db, but if i can see it in access, i should be able to convert.

thanks!
~ Andrea