Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 16, 2012 03:34 PM by henrik108
Member
5 Points
9 Posts
May 16, 2012 07:36 AM|LINK
Hi
Is it possible to exclude the _PageStart.cshtml from one page.
In my case i want to exclude it from the login-page (Login.cshtml)
Contributor
5446 Points
735 Posts
May 16, 2012 10:27 AM|LINK
I think you could test in _PageStart.cshtml if the requested page is Login.cshtml, excluding Login.cshtml from its execution.
The method Request.FilePath returns the relative path of the current request and it's useful for knowing which is the page requested by the user.
May 16, 2012 12:35 PM|LINK
GmGregori I think you could test in _PageStart.cshtml if the requested page is Login.cshtml, excluding Login.cshtml from its execution. The method Request.FilePath returns the relative path of the current request and it's useful for knowing which is the page requested by the user.
Like this?
@{ if (Request.FilePath != "/login.cshtml") { ....code that will be executed in _PageStart } }
May 16, 2012 03:16 PM|LINK
Yes. It should work.
Let me know.
May 16, 2012 03:34 PM|LINK
You were right. it worked ;)
henrik108
Member
5 Points
9 Posts
Exclude _PageStart.cshtml
May 16, 2012 07:36 AM|LINK
Hi
Is it possible to exclude the _PageStart.cshtml from one page.
In my case i want to exclude it from the login-page (Login.cshtml)
GmGregori
Contributor
5446 Points
735 Posts
Re: Exclude _PageStart.cshtml
May 16, 2012 10:27 AM|LINK
I think you could test in _PageStart.cshtml if the requested page is Login.cshtml, excluding Login.cshtml from its execution.
The method Request.FilePath returns the relative path of the current request and it's useful for knowing which is the page requested by the user.
henrik108
Member
5 Points
9 Posts
Re: Exclude _PageStart.cshtml
May 16, 2012 12:35 PM|LINK
Like this?
@{
if (Request.FilePath != "/login.cshtml")
{
....code that will be executed in _PageStart
}
}
GmGregori
Contributor
5446 Points
735 Posts
Re: Exclude _PageStart.cshtml
May 16, 2012 03:16 PM|LINK
Yes. It should work.
Let me know.
henrik108
Member
5 Points
9 Posts
Re: Exclude _PageStart.cshtml
May 16, 2012 03:34 PM|LINK
You were right. it worked ;)