Showing posts with label newbie. Show all posts
Showing posts with label newbie. Show all posts

Saturday, March 24, 2012

Pass XML File to web page

Ok, I'm a relative web newbie here so bear with me...
I need to pass an XML file to an ASP.Net web page on a remote server.
The .net page will read this XML file and act upon its contents. How
do I go about passing such a file?
thanks in advance...
-Mike"bdtmike" <mike.aes@.gmail.com> wrote in news:1139459368.262630.114360
@.g44g2000cwa.googlegroups.com:

> Ok, I'm a relative web newbie here so bear with me...
> I need to pass an XML file to an ASP.Net web page on a remote server.
> The .net page will read this XML file and act upon its contents. How
> do I go about passing such a file?
That sounds like a web service : )
Stan Kee (spamhoneypot@.rogers.com)
Boycott StarForce!
http://www.glop.org/starforce
You've not said what your client is, as you could just do a file upload if
its a asp.net page and open the file on the server using the xml classes.
If its a client app, theres a good example here:
http://www.codeproject.com/Purgatory/XmlPost.asp
Regards
John Timney
Microsoft MVP
"bdtmike" <mike.aes@.gmail.com> wrote in message
news:1139459368.262630.114360@.g44g2000cwa.googlegroups.com...
> Ok, I'm a relative web newbie here so bear with me...
> I need to pass an XML file to an ASP.Net web page on a remote server.
> The .net page will read this XML file and act upon its contents. How
> do I go about passing such a file?
> thanks in advance...
> -Mike
>
Well, here's what I want: I have an ASP.Net web page that will produce
a google map with points plotted on the map. Points and other
parameters are passed to this page via XML. The page should act on
this file and render the page accordingly. The client would be an IE
browser. The end result is a web page.
John,
how do you do a file upload to an ASP page?
lots of articles on this topic
http://www.codeproject.com/aspnet/fileupload.asp
Regards
John Timney
Microsoft MVP
"bdtmike" <mike.aes@.gmail.com> wrote in message
news:1141570184.957328.238320@.i40g2000cwc.googlegroups.com...
> John,
> how do you do a file upload to an ASP page?
>
You want something like this web page does?
http://www.reimers.dk/atlas/map.aspx

Pass XML File to web page

Ok, I'm a relative web newbie here so bear with me...

I need to pass an XML file to an ASP.Net web page on a remote server.
The .net page will read this XML file and act upon its contents. How
do I go about passing such a file?

thanks in advance...

-MikeYou've not said what your client is, as you could just do a file upload if
its a asp.net page and open the file on the server using the xml classes.
If its a client app, theres a good example here:

http://www.codeproject.com/Purgatory/XmlPost.asp

--
Regards

John Timney
Microsoft MVP

"bdtmike" <mike.aes@.gmail.com> wrote in message
news:1139459368.262630.114360@.g44g2000cwa.googlegr oups.com...
> Ok, I'm a relative web newbie here so bear with me...
> I need to pass an XML file to an ASP.Net web page on a remote server.
> The .net page will read this XML file and act upon its contents. How
> do I go about passing such a file?
> thanks in advance...
> -Mike
Well, here's what I want: I have an ASP.Net web page that will produce
a google map with points plotted on the map. Points and other
parameters are passed to this page via XML. The page should act on
this file and render the page accordingly. The client would be an IE
browser. The end result is a web page.
John,
how do you do a file upload to an ASP page?
lots of articles on this topic

http://www.codeproject.com/aspnet/fileupload.asp

--
Regards

John Timney
Microsoft MVP

"bdtmike" <mike.aes@.gmail.com> wrote in message
news:1141570184.957328.238320@.i40g2000cwc.googlegr oups.com...
> John,
> how do you do a file upload to an ASP page?
You want something like this web page does?
http://www.reimers.dk/atlas/map.aspx

Wednesday, March 21, 2012

Passing A String

Hello, I am a newbie. Thanks for all the great help I have recieved so far. Here is my latestest question.
I am trying to capture the referring site and the landing page url with query string on the initial entry page of my website. I am able to add these values to session, but they get overwritten each page I visit. My guess is that I need to write some sort of boolean test so these values are not added again if they already exist. Here is the code I have written.
Thanks for your help.
John

// Get query string

string urlreffer =Convert.ToString(Request.UrlReferrer);

string urlraw =Convert.ToString(Request.RawUrl);

string sessionid =Convert.ToString(Request.Cookies);

// add to session

Session.Add("reffer", urlreffer);

Session.Add("rawurl", urlraw);

Session.Add("sessionid", sessionid);

Hello,
In what event do you have this code, in the page_Load event? If so, surround the code with:
if (!page.IsPostBack) {
}
If another event, let me know.
HTH.

protectedvoid Page_Load(object sender,EventArgs e)

{

// Get query string

string urlrefer =Convert.ToString(Request.UrlReferrer);

string urlraw =Convert.ToString(Request.Url);

string sessionid =Convert.ToString(Request.Cookies["ASP.NET_SessionId"].Value);

// test to see if values are already in session.

if (Session["refer"] ==null ||Convert.ToString(Session["refer"]).Length == 0)

{

// add to session

Session.Add("refer", urlrefer);

Session.Add("rawurl", urlraw);

Session.Add("sessionid", sessionid);

}

}

}

passing a string to a confirmation page

Hi folks -- newbie Dave here.

I have a page where a user enters some basic info (name, email address, etc.), then they click Submit.

I then display a confirmation page. I want to display text that says something like "Thanks Dave, we got your info".

In the info form page, I'm doing this when Submit is clicked:

Sub ConfirmMsg()
Dim name As String
name = txName.Text
Response.Redirect("free_cvi_confirm.aspx?name")
End Sub

Here is the Page_Load function on the confirmation page:

Private Sub Page_Load(ByVal .....)
Label1.Text = "Thanks " + Request.QueryString("name") + ", we got your info"
End Sub

This displays nothing when Label1 displays. And when I look in Request.QueryString, I also can't find the name value.

What am I doing wrong? I've tried a few different variations, but can't seem to hit it. Thanks in advance for your great help.

DaveHello, in the page where u submit the form the conform message page should be like this:


Protected Sub ConfirmMsg(ByVal sender As Object, ByVal e As EventArgs)
Dim name As String = String.Empty
name = txName.Text
Response.Redirect("free_cvi_confirm.aspx?name=" + name)
End Sub

In the second page:


Protected Sub Page_Load(ByVal src As Object, ByVal e As EventArgs)
Label1.Text = "Thanks " + Request.QueryString("name").ToString() + ", we got your info"
End Sub

Good Luck.
HI davehunt,

Welcome the asp.net forums...

Use this

Response.Redirect("free_cvi_confirm.aspx?name=" & name)

thatz it
I believe that the 2 methods suggested so far place the values of the variables in the querystring (and then retrieve the values from the querystring). If having the variables visible in the querystring is acceptable, then I don't see any reason not to use those methods.

However, if you want to "post" the variables instead use this...

In the first page:
<script runat="server">
Sub Submit(Sender as Object, e as EventArgs)
Server.Transfer("http://path/page2.aspx")
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:TextBox ID="tbName" Runat="server" />
<br>
<asp:Button Text="Submit" Runat="server" OnClick="Submit" />
</form>
</body>
</html
In the second page:
<script runat="server">
Sub Page_Load(Sender as Object, e as EventArgs)
lblName.Text = Request.Form("tbName")
End Sub
</script>
<html>
<body>
<form runat="server">
Name =
<asp:Label id="lblName" Runat="server" />
</form>
</body>
</html
Hope this helps,
Rob
Thanks guys, this was a big help.

Dave