Hello guest! Welcome to Rajeev & Associates.
(011) 45054000
contact@carajeev.com
Rajeev & Associates
CHARTERED ACCOUNTANTS
Established
1986
Toggle navigation
Home
Our Team
Services
Corporate Finance
Services for Non-Residents
Accounting Services
Corporate Services
Payroll
Benefits of Outsourcing
Income Tax
TDS
Value Added Tax
Subsc_with_us
Audit
Service Tax
Blog
Acts
Direct Tax
Income Tax Act
Wealth Tax Act
Income Declaration Scheme 2016
Indirect Tax
Service Tax(Finance Act, 1994)
Central Sales Tax Act, 1956
The Central Excise Act, 1944
Customs Act, 1962
Entry Tax Act
Corporate Laws
Companies Act, 2013
Companies Act, 1956
LLP ACT
SEBI Act, 1992
Company Secretaries Act, 1980
Other Statutes
ESI Act, 1948
PF Act, 1952
Profession Tax Act
The Indian Partnership Act, 1932
Societies Registration Act, 1860
Competition Act, 2002
Reserve Bank of India Act, 1934
MRTP Act, 1969
Equalisation Levy Act, 2016
Right To Information Act, 2005
FEMA, 1999
Maharashtra RERA
RERA, 2016
Insolvency & Bankruptcy Code, 2016
Benami Property Act 1988
GST Laws
IGST Act , 2017
CGST Tax Act, 2017
UTGST Act, 2017
GST (Compensation to States) Act
Knowledge Bank
Calculators
GST Calculator
Tax Calculator
TDS Calculator
Calculate Net Profit
Calculate Net Worth
Effective Capital
HRA
NSC
EMI
Auto Loan Calculator
Home Loan Calculator
Get No. Of Instalment
RERA Calculator
Developers Calculator
Home Buyer Delay Interest
Home Buyer Refund
Bulletins
RBI SEBI
Notification
Circular
Income Tax
Service Tax
Central Sales Tax
Excise Matters
Customs
Company Law
Labour Laws
FEMA
The LLP Act 2008
Accounting Standard (INDAS)
Others
GST
VAT
Delhi VAT
Maharastra VAT
Gujarat VAT
Telangana VAT
Tamil Nadu VAT
IGST
UTGST
Compensation Cess
IBC Regulation
Utilities
Rates of TDS
TDS Rates for N.R.I us 195
Rates of Income Tax
Depreciation Rates Companies Act
Depreciation Rates Income Tax Act
ROC Filing Fees (Cos Act, 2013)
ROC Fee Structure (Cos Act, 2013)
Cost Inflation Index
IFSC Codes
MICR Codes
Rates of NSC Interest
Gold and Silver Rates
Rates of Stamp Duty
LLP Fees
National Industries Classification
HSN Rate List
Deduction u/s 80TTA Vs 80TTB
Links
Quick Links
Important Links
GST/VAT Links
Ease Of Doing Business
Acts
Direct Tax
Income Tax Act
Wealth Tax Act
Income Declaration Scheme 2016
Indirect Tax
Service Tax(Finance Act, 1994)
Central Sales Tax Act, 1956
The Central Excise Act, 1944
Customs Act, 1962
Entry Tax Act
Corporate Laws
Companies Act, 2013
Companies Act, 1956
LLP ACT
SEBI Act, 1992
Company Secretaries Act, 1980
Other Statutes
ESI Act, 1948
PF Act, 1952
Profession Tax Act
The Indian Partnership Act, 1932
Societies Registration Act, 1860
Competition Act, 2002
Reserve Bank of India Act, 1934
MRTP Act, 1969
Equalisation Levy Act, 2016
Right To Information Act, 2005
FEMA, 1999
Maharashtra RERA
RERA, 2016
Insolvency & Bankruptcy Code, 2016
Benami Property Act 1988
GST Laws
IGST Act , 2017
CGST Tax Act, 2017
UTGST Act, 2017
GST (Compensation to States) Act
Rules
Direct Tax Rules
Income Tax Rules
Wealth Tax Rules 1957
Income Declaration Scheme Rules 2016
Indirect Tax Rules
GST Valuation Rules , 2016
Service Tax Rules
CST (Delhi) Rules, 2005
CST (Maharashtra) Rules
Customs Valuation Rules
Cenvat Credit Rules, 2017
Entry Tax Rules
Corporate Laws Rules
Companies Rules, 2014
LLP Rules, 2009
LLP Winding up Rules, 2012
Cos Unpaid Dividend Rules, 1978
VAT Laws Rules
Delhi VAT Rules, 2005
Maharashtra VAT Rules, 2005
West Bengal VAT Rules, 2005
Tamilnadu VAT Rules, 2007
Karnataka VAT Rules, 2005
Gujarat VAT Rules, 2006
Uttar Pradesh VAT Rules, 2008
Rajasthan VAT Rules, 2006
Punjab VAT Rules
Haryana VAT Rules, 2003
Telangana VAT Rules 2005
Andhra Pradesh VAT Rules, 2005
Bihar Value Added Tax Rules, 2005
Other Statutes
Profession Tax Rules
NBFC Deposits Directions, 1998
NBFC & Misc NBC (Advt) Rules, 1977
NBFC Auditor Report Directions, 2008
Delhi Labour Welfare Fund Rules, 1997
Cost records and audit Rules, 2014
Baggage Rules, 2016
Equalisation Levy Rules, 2016
NCLT And NCLAT Rules
Insolvency & Bankruptcy Rules
Benami Property Rules, 2016
GST Rules
CGST Rules, 2017
IGST Rules 2017
Forms
Income Tax Forms
ROC Forms (Cos Act, 2013)
ROC Forms (Cos Act, 1956)
Income Declaration Forms
Wealth Tax Forms
Service Tax Forms
Companies Unpaid Dividend Forms
NBFCs Forms
LLP Winding up
FEMA Forms
LLP Forms
CGST Forms
GST Forms
Accounts and Records
Advance Ruling
Appeals and Revision
Assessment and Audit
Composition
Demands and Recovery
Input Tax Credit
Inspection, Search and Seizure
Offences and Penalties
Payment of Tax
Refund
Registration
Returns
Transitional Provisions
Value of Supply
Careers
Pay Now
Admin
Login
Email Login
Web-EDGE
GST Login
Contact Us
Blog Categories
All
Sub News (0)
yet another post
Category: News, Posted on: 26/12/2011
Visitor Count:
479
Often you need to pass variable content between your html pages or aspx webforms in context of Asp.Net. For example in first page you collect information about your client, her name and last name and use this information in your second page. For passing variables content between pages ASP.NET gives us several choices. One choice is using QueryString property of Request Object. When surfing internet you should have seen weird internet address such as one below. http://www.localhost.com/Webform2.aspx?name=Atilla&lastName=Ozgur This html addresses use QueryString property to pass values between pages. In this address you send 3 information. Webform2.aspx this is the page your browser will go. name=Atilla you send a name variable which is set to Atilla lastName=Ozgur you send a lastName variable which is set to Ozgur As you have guessed ? starts your QueryString, and & is used between variables. Building such a query string in Asp.Net is very easy. Our first form will have 2 textboxes and one submit button. Put this code to your submit button event handler. Collapse | Copy Code private void btnSubmit_Click(object sender, System.EventArgs e) { Response.Redirect("Webform2.aspx?Name=" + this.txtName.Text + "&LastName=" + this.txtLastName.Text); } Our first code part builds a query string for your application and send contents of your textboxes to second page. Now how to retrieve this values from second page. Put this code to second page page_load. Collapse | Copy Code private void Page_Load(object sender, System.EventArgs e) { this.txtBox1.Text = Request.QueryString["Name"]; this.txtBox2.Text = Request.QueryString["LastName"]; } Request.QueryString is overloaded with a second way. You can also retrieve this values using their position in the querystring. There is a little trick here. If your QueryString is not properly built Asp.Net will give error. Collapse | Copy Code private void Page_Load(object sender, System.EventArgs e) { this.txtBox1.Text = Request.QueryString[0]; this.txtBox2.Text = Request.QueryString[1]; } Some other ways to reach contents of QueryString. Collapse | Copy Code foreach( string s in Request.QueryString) { Response.Write(Request.QueryString[s]); } Or Collapse | Copy Code for (int i =0;i < Request.QueryString.Count;i++) { Response.Write(Request.QueryString[i]); } Advantages of this approach It is very easy. Disadvantages of this approach QueryString have a max length, If you have to send a lot information this approach does not work. QueryString is visible in your address part of your browser so you should not use it with sensitive information. QueryString can not be used to send & and space characters. If you write this code and try them you will see that you have a problems with space and & characters, e.g. if you need to send a variable which contains & such as "Mark & Spencer". There must be a solution for this problem. If you look to Google�s query string you will see that it contains a lot of %20. This is the solution of our third disadvantage. Replace space with %20 and & with %26 for example. Collapse | Copy Code private void btnSubmit_Click(object sender, System.EventArgs e) { string p1 = this.txtName.Text.Replace("&","%26"); p1 = this.txtName.Text.Replace(" ","%20"); string p2 = this.txtLastName.Text.Replace("&","%26"); p2 = this.txtName.Text.Replace(" ","%20"); "WebForm2.aspx?" + "Name=" + p1 + "&LastName=" + p2; Response.Redirect(p2); } Since this is a such a common problem Asp.Net should have some way to solve. There it is Server.UrlEncode. Server.UrlEncode method changes your query strings to so that they will not create problems. Collapse | Copy Code private void btnSubmit_Click(object sender, System.EventArgs e) { Response.Redirect("WebForm2.Aspx?" + "Name=" + Server.UrlEncode(this.txtName.Text) + "&LastName=" + Server.UrlEncode(this.txtLastName.Text)); } Same solution is in Microsoft .Net Quick Start tutorials. ASP.NET --- Working with Web Controls --- --- Performing Page Navigation (Scenario 1) --- --- Performing Page Navigation (Scenario 2) --- Look at them also if you want to see more example for this technique. Also I advise you to look at Alex Beynenson's article about building QueryString(s).
Disclaimer: The content of the blog does not create any responsibility of the firm / its authorized persons whose website is being accessed. The blog is not for legal use. Kindly verify the correctness of data/contents from your own sources. This is only for information purpose.
Add a Comment
Name:
Your Comment:
Login with Google
Login with Facebook
View Comments
(
0
)
856390
Times Visited
Webtel
Webtel
Webtel