Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I am creating a website in asp.net..i want as user first time opens the website a ajax/jquery type window should open where he/she has to enter name and phone no. and then can proceed to the website...
i tried a pop up window but that was not i wanted as i need a smoothie page should be opened first

as if you open this site the thing happens i need the same one the same type of window

[spam link removed]

please help me..thanks in advance
Posted
Updated 20-Nov-14 22:49pm
v2
Comments
Thanks7872 21-Nov-14 4:50am    
Never mention links like this. We are not suppose to visit it. You have been given enough space to explain whatever you want.

As per as the question is concerned, you can open popup when page loads using Javascript.
manishmns12 21-Nov-14 4:57am    
sorry for that..i know i can make that through java script but i dont want that type of popup..
i need the same as i mentioned in the link..please help me na....

Since you don't want any JavaScript powered alert box, then the remaining concept is to just redirect the user to a page where a form is waiting for him to enter his details.

In ASP.NET you can use the Session[^] variables to work with the Session of the user. Session is created when he first visits your website and are removed as soon as he leaves your website; closes the browser etc. In ASP.NET you can create a Session variable as

C#
Session["variable_name"] = "value";


Now this variable will be different for every user and for every session. You can use them to save Session related values. Good thing about session variables is that you can remove them if you want to remove them before the user closes the session too.

You wanted to check if the user is visiting for the very first time and has set the name for him or not, you could create a variable for the name (you can create the variable to store the phone_number too; but I am going to provide the answer for the name only), as this

C#
Session["name"] = null;


.. now when he visits your website, in your master page (layout page if you're using Web Pages framework of ASP.NET; others would have a master page) write this code

C#
if(Session["name"] == null) {
   // Redirect him to the page
} else {
   // it contains the value for his name
}


Remember: These variables are same on all of the pages, so make sure that you only redirect when the user is not on the web page where the form is. Because if you redirect him from the form page too, the Browser would terminate the request saying, "Request resulted in an infinite redirect". https://en.wikipedia.org/wiki/URL_redirection[^]
 
Share this answer
 
on default.aspx.cs coding page in a page load use the Response.Redirect("yourpagename.aspx")

C#
protected void Page_Load(object sender, EventArgs e)
    {
        Response.Redirect("~/login.aspx");
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900