Total Page Preview: 000000002128
What is cookies in ASP.NET in English and Hindi
Cookies in ASP.NET in English
In ASP.NET, cookies are small text files that are stored on the client's computer. Cookies are used to store data that can be accessed by the server or client-side scripts. Cookies can be used to store user preferences, login information, and other data that needs to persist between requests.
Here is an example of how to create and use cookies in ASP.NET:
In this example, we create a cookie named "myCookie" and set its "username" value to "JohnDoe". We also set the cookie to expire in one hour.
To retrieve the cookie, we check if it exists in the Request.Cookies collection and then access the "username" value.
To remove the cookie, we set its expiration date to a past date, and then add it to the Response.Cookies collection.
Cookies in ASP.NET in Hindi
ASP.NET mein cookies chhotey text files hote hain jo client ke computer par store hote hain. Cookies server ya client-side scripts dwara access kiye jaane wale data ko store karne ke liye use kiye jaate hain. Cookies ka use user preferences, login information aur dusre data ko store karne ke liye kiya jaata hai, jo ki requests ke beech mein persistent rehna chahiye.
Neeche diye gaye example mein cookies kaise create aur use kiya jaata hai, iska ek example diya gaya hai:
Is example mein, hum "myCookie" namak ek cookie create karte hain aur uske "username" value ko "JohnDoe" set karte hain. Hum cookie ko ek ghante ke baad expire karne ke liye bhi set karte hain.
Cookie retrieve karne ke liye, hum Request.Cookies collection mein check karte hain ki kya ye hai aur phir "username" value ko access karte hain.
Cookie remove karne ke liye, hum uski expiration date ko past date par set karte hain aur use Response.Cookies collection mein add karte hain.
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com