Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
after login i opened one page but that url is opened in another broser it is opening but it is not open until login how to do that in mvc
<script type="text/javascript">
    function noBack() {
        window.history.forward()
    }
        noBack();
        window.onload = noBack;
        window.onpageshow = function(evt) { if (evt.persisted) noBack() }
        window.onunload = function() { void (0) }
    </script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
	<title>IQM soft Samples</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<link rel="shortcut icon" href="@Url.Content("~/Content/css/images/favicon.ico")" />
	<link rel="stylesheet" href="@Url.Content("~/Content/css/style.css")" type="text/css" media="all" />
    <link rel="stylesheet" href="@Url.Content("~/Content/css/menu_style1.css")" type="text/css" media="all" />
	<script src="@Url.Content("~/Content/js/jquery-1.7.1.min.js")" type="text/javascript" charset="utf-8"></script>
	<script src="@Url.Content("~/Content/js/jquery.jcarousel.min.js")" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- Wrapper -->
	<div id="wrapper">
		<!-- Header -->
        <div style="border: px solid #000; width:100% ; background:# ;">
		<div id="header" class="shell" style="border: px solid #000; background:# ;
        ">
			<!-- Social links -->
			<div class="social-links">
				<ul>

				</ul>
			</div>
			<!-- Social links -->
		
			<div >
				<img src="@Url.Content("~/Content/css/images/a1.png")" alt="" style="width:500px;height:130px;" />
			</div> 
		</div></div>
		<!-- End Header -->
		<!-- Navigation -->
		 
            <div style="  width:100%; height:auto; background: removed(@Url.Content("~/Content/css/images/navigation.png"));  margin-bottom:  px; ">
    <div class="menu1234" style="border: px solid #000; width:1000px; margin:0 auto;margin-removed170px; ">
        <ul><li>Home</li>
            <li>Add Samples</li>
            <li>View Samples</li>
             <li> Categories</li>
             
             <li> Add Employees</li>
                  <li>View Employees</li>
            <li>Logout</li>
                           
            </ul>

            <!-- Menu Only for Admin and Staff1 -->

            
@*                <li>Products
                    <ul>
                        <li>Packages</li>
                        <li>Brands</li>
                        <li>Part Types</li>  
                        <li>Parts</li>
                    </ul>
                </li>*@

                <!-- Menu Only for Admin and Staff1 -->

                @*<li>Stock</li>

                <!-- Menu Only for Admin -->

                                <li>Users

                    <ul>
                        <li>Installer</li>
                        <li>Staff</li>                  
                    </ul>*@
                </li>	
                		
                 

        </ul>
    </div>

 
		</div>
		<!-- End Navigation -->
		<!-- Main -->
        <div class="removed123" style="height:auto;width:1150px;overflow:hidden;margin-removed170px;margin-removed50px;">
            <div style="float:right;font-size:15px;color:red;margin-removed50px;"><br />You are  :Admin</div>
            @RenderBo
Posted
Updated 20-Nov-13 1:25am
v3
Comments
bbirajdar 20-Nov-13 6:21am    
Read the question once again. Try using full stop(.) atleast so that we can understand a bit.
♥…ЯҠ…♥ 20-Nov-13 6:24am    
Its not mandatory that question title and question description needs to be same.. you can give some more additional information about your question in here.......
sailaja123456 20-Nov-13 6:43am    
i id on mvc project so after admin login i have few fields in admin so in that i have add view forms so if i click the button add form will be opened and i copied that url and paste into another browser so it is displayed but what to do for that url displayed only after login
♥…ЯҠ…♥ 20-Nov-13 6:59am    
Another browser in the sense? another instance of same browser or different browser?
sailaja123456 20-Nov-13 7:07am    
different broswer

1 solution

Hi sailaja,

I think you are not maintaining any session in your application.
If you are then you need to check the session variable at _layout.cshtml file.
If the session is empty then redirect to login page.
Same as you implement in asp.net traditional page.

You can refer this link[^] for reference.
Note: Different browsers wont share common sessions as far as I know.
Hope this helps you a bit.

Regards,
RK
 
Share this answer
 
v2
Comments
sailaja123456 20-Nov-13 7:18am    
<script type="text/javascript">
function noBack() {
window.history.forward()
}
noBack();
window.onload = noBack;
window.onpageshow = function(evt) { if (evt.persisted) noBack() }
window.onunload = function() { void (0) }
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<title>IQM soft Samples</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="@Url.Content("~/Content/css/images/favicon.ico")" />
<link rel="stylesheet" href="@Url.Content("~/Content/css/style.css")" type="text/css" media="all" />
<link rel="stylesheet" href="@Url.Content("~/Content/css/menu_style1.css")" type="text/css" media="all" />
<script src="@Url.Content("~/Content/js/jquery-1.7.1.min.js")" type="text/javascript" charset="utf-8"></script>
<script src="@Url.Content("~/Content/js/jquery.jcarousel.min.js")" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<div style="border: px solid #000; width:100% ; background:# ;">
<div id="header" class="shell" style="border: px solid #000; background:# ;
">
<!-- Social links -->
<div class="social-links">
<ul>

</ul>
</div>
<!-- Social links -->

<div >
<img src="@Url.Content("~/Content/css/images/a1.png")" alt="" style="width:500px;height:130px;" />
</div>
</div></div>
<!-- End Header -->
<!-- Navigation -->

<div style=" width:100%; height:auto; background: url(@Url.Content("~/Content/css/images/navigation.png")); margin-bottom: px; ">
<div class="menu1234" style="border: px solid #000; width:1000px; margin:0 auto;margin-left:170px; ">
<ul><li>Home</li>
<li>Add Samples</li>
<li>View Samples</li>
<li> Categories</li>

<li> Add Employees</li>
<li>View Employees</li>
<li>Logout</li>

</ul>

<!-- Menu Only for Admin and Staff1 -->


@* <li>Products
<ul>
<li>Packages</li>
<li>Brands</li>
<li>Part Types</li>
<li>Parts</li>
</ul>
</li>*@

<!-- Menu Only for Admin and Staff1 -->

@*<li>Stock</li>

<!-- Menu Only for Admin -->

<li>Users

<ul>
<li>Installer</li>
<li>Staff</li>
</ul>*@
</li>



</ul>
</div>


</div>
<!-- End Navigation -->
<!-- Main -->
<div class="content123" style="height:auto;width:1150px;overflow:hidden;margin-left:170px;margin-top:50px;">
<div style="float:right;font-size:15px;color:red;margin-right:50px;"><br />You are :Admin</div>
@RenderBo
♥…ЯҠ…♥ 20-Nov-13 7:24am    
you can use improve question option sailaja.. ok this time i'll update it.
sailaja123456 20-Nov-13 7:28am    
is it solved im not understanding can u plz xplain how to solve this
♥…ЯҠ…♥ 20-Nov-13 7:30am    
updated the link in my solution for your reference.
sailaja123456 20-Nov-13 7:33am    
im confusing where that answer give me a link

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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