?
Solved

session variables and request.querytring in .net

Posted on 2014-10-30
2
Medium Priority
?
147 Views
Last Modified: 2014-11-02
Usually I write in Classic ASP, but now I'm stuck with a .NET code i need to change:

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Pliskin.Index" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
    .ltor
    {
          direction:rtl;
          overflow:hidden;
          resize: none;
    }
    .ltor:focus
    {
          outline: none;
    }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:Panel BackColor="#FFFFCC" runat="server" Width="410">
    <asp:TextBox BorderStyle="None" runat="server" ReadOnly="True" ID="Directions" TextMode="MultiLine" CssClass="ltor" Height="400" Width="400" Font-Size="X-Large" BackColor="#FFFFCC"></asp:TextBox>
    <br />
    <asp:TextBox ID="Username" runat="server"></asp:TextBox>
    <asp:Button runat="server" OnClick="Start" Text="Start" />
    </asp:Panel>
</asp:Content>

Now this code works - but I need it to include two additional things
1) To create a session variable -
<%session("id")=request.querystring("uid")%>

2) To put that value as the value of the "username" variable -
<asp:TextBox ID="Username" runat="server" value="<%=request.querystring("uid")%>" disable></asp:TextBox>

When I try to change it - the file don't work anymore
0
Comment
Question by:arielbf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 total points
ID: 40414910
Please use code behind (Index.aspx.cs) page_load event:
string uid = Request.QueryString["uid"];
HttpContext.Current.Session = uid;
Username.Text = uid;

Open in new window


No need to define it in the mark up
0
 

Author Closing Comment

by:arielbf
ID: 40418856
Thank you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question