|
I don't thinks so
I have login page user will enter his username to enter the main page "every things fine till now". the problem is when the user jump to address bar in the browser and write manually the path to the main page he will be able to access the website with out entering his log in information.
please help me I need to block accessing to any web page unless the user enter his username.
thanks in advance guys,
|
|
|
|
|
when user login then take his id in session and check follwoing on next page
if session("userid")=nothing then
response.redirect("loginpage")
I think it solve your problem.
Rahul
|
|
|
|
|
thanks a lot rahul.net11,
it worked perfectly.
I have another two other questions
1- how can I kill the session??
2- what is (Nothing key work ) you have used? I did follow your solution but I check the user session with the default string value I have set to all session in Global.asax. are they any way to set the string in global.asax to null.
|
|
|
|
|
Hi
If you want to kill session then u can use session("sessionname").Remove.
This will remove a particular session and i you want to remove all session
on the page then u can use session.Removeall().
regarding Nothing keyword if u r using vb.net then you can use Nothing
keyword or if u r using C# then us can use Session("userid")="".
Nothing is a keyword used in vb.net.If any query then let me know abtit.
Rahul
|
|
|
|
|
thanks that was helpful
but how can I get the sessionname ??
|
|
|
|
|
In each page load where authentication is needed you need to ensure that login details are supplied. You can check session in page load like
if ( Session["userid"] == null )
Response.Redirect("Login.aspx");
User id is the session variable which you are filling when user logs in.
If you have lot of pages which needs this checking, better approach would be creating a base class that does this. Inherit all your pages from this base class.
|
|
|
|
|
N a v a n e e t h ,
yes i have lot of pages can you give me an idea about the base class please
|
|
|
|
|
aziz_subaie wrote: can you give me an idea about the base class please
Well, by default as you see ASP.NET page will be inherited from System.Web.UI.Page . This is the base class which has properties needed for page initialization. But if you want to have some additional functionalities for all your pages, you can create a custom base class that inherits from Page and your ASP.NET page inherits from your custom class.
Assume you have created a base class called CAuthentication . It could be some thing like
class CAuthentication:System.Web.UI.Page
{
private void override OnLoad(object sender,EventArgs e)
{
base.OnLoad(e);
}
}
Let's look into your ASPX.CS page.
class MyPage:CAuthentication
{
protected void Page_Load()
{
}
}
When you run your page, CAuthetication will be invoked first and do your session checking. So this will help you to avoid rewriting session checking function in all of your pages. This base class can also be useful for extending Page class functionalities.
|
|
|
|
|
I am using Visual Studio 2005 Standard Edition. I know that crystal reports has come in built with this version. But I am unable to view the crystal report template in add new items. How to get that template. Help needed. Thank you.
|
|
|
|
|
in VB.NET
procedure to add in crystal reports .rpt file into your solution
File
- New
-Project
Choose language Visual Basic or Visual C#
here you can find the Crystal Report Application Icon
give a name and add
winnie -
|
|
|
|
|
in ASP.NET
File
-New
- Web Site
you can find the "Asp.net Crystal Reports Web Site Icon"
winnie
|
|
|
|
|
Don't cross post.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
im giving treeview node colour using this code (shown below)
treenode.Text =
"<font color = #066C57 >" Addition "</font>";
bt at that time its tooltip is showing
"<font color = #066C57 >" Addition "</font>";
when im giving treenode.tooltip="something" it is nt working
pls give me a solution
-- modified at 6:30 Friday 10th August, 2007
|
|
|
|
|
TreeView1.Nodes[0].Text="Some text for first node";<br />
TreeView1.Nodes[0].ToolTip="ToolTip for first node";
I Love SQL
|
|
|
|
|
I have a problem calling my css onto my page.Is there another way to do this coz I tried using
but its not calling it
kagiso
|
|
|
|
|
Make sure that path exist. If themes directory is in root of site then you need to specify like /themes/
|
|
|
|
|
If you can't see it, it's likely that your href doesn't actually point to the css file. This is normally because of relative path issues. Try adding ~/ before the word Themes in your href.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Assuming the page calling the CSS is located in folder F1, the URL you are providing means that the folder Themes is located inside F1.
Other possibility: Could it be that you mean to access a CSS page belonging to a theme (inside the App_Themes) in your website, because you can't do that.
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
I am trying to connect to Sql server 2005 database using Visual web developer 2005 forms remotely..But the connection is not established and giving error given below
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Please help me........
|
|
|
|
|
|
I could not find web.config in Visual studio express 2005 projects...Did i missing something..
|
|
|
|
|
Visual Studio Express for Web Developer or C# express?
If you are using Web Developer VS Express then you add web.config to your website from "Add New Item" of LeftMenu..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
i have string variable which has xml data. how to parse this variable to get values using c#.net?
|
|
|
|
|
Hi
Can anyone help me in refreshing asp.net page, which contains grid without page being blank. Grid is connected to database and fetches data from database at load time. I have tried doing it but my page becomes blank at the time of refreshing. is there any way to do this using ajax?
thanx n bye
Ratnadeep
Mumbai
|
|
|
|
|
What do you mean exactly by the page becomes blank? How are you refreshing? is it by clicking on a button in the form or by clicking the "reload" of the browser?
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|