Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. asp.net application C# with asp.net C# web application

asp.net application C# with asp.net C# web application

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aminowest
    wrote on last edited by
    #1

    I have a an asp.net web application with C# page that sends username and password to an asp.net web application with C# but different application. I need to pass these data to the asp.net we bapplication but without using the Response.Redirect method. I tried to use the HttpWepRequest and HttpWebResponse ways.I use the following code in the source page: string strId = "1"; string strName = "amino"; //string result =""; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = "userid=" + strId; postData += ("&username=" + strName); byte[] data = encoding.GetBytes(postData); // Prepare web request... HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:1644/TragetApp/Default.aspx"); myRequest.Method = "POST"; myRequest.ContentType = "application/x-www-form-urlencoded"; myRequest.ContentLength = data.Length; myRequest.AllowAutoRedirect = false; Stream newStream = myRequest.GetRequestStream(); // Send the data. newStream.Write(data, 0, data.Length); newStream.Close(); //Response.End(); //prepare response Stream receiveStream; HttpWebResponse myWebResp = (HttpWebResponse)(myRequest.GetResponse()); receiveStream = myWebResp.GetResponseStream(); //result = sr.ReadToEnd(); receiveStream.Close(); in the page_load of the target page i do the following to c the username: protected void Page_Load(object sender, EventArgs e) { Label1.Text = Request["username"].ToString();//.QueryString["name"].ToString(); Response.Output.WriteLine(Request["username"].ToString()); } I put a break poit in the page_load of the target page. The username is sent correctly to the target page but after i continue running i found that the displayed page is the source page. I need to stop at the target page after receiving the username. What can i do?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups