|
Hello,
I've created a class which inherits system.web.ui.page (the default inherits of an aspx page). In this class I can use session object but I can't use request object nor server object .
1. Which class shall I inherits to use this object ?
2. How can I simply add a little code to all my page_load sub. I want to check on each page load if the session is still active and if the current user as enough right to load this page. I thought about writing a new class which will inherits default aspx web page class but as I say in point 1, I can't use request and server object. If you have any solution, it will be very welcome.
Thanx
Sybux
|
|
|
|
|
sybux2000 wrote:
n this class I can use session object but I can't use request object nor server object
Thats odd. Just as a quick thought (I have not tried this) but in your class have you referenced using System.Web at all? Might need to, not sure.
|
|
|
|
|
Sorry but It's not possible to reference the full namespace.
Has some an idea ?
|
|
|
|
|
sybux2000 wrote:
Sorry but It's not possible to reference the full namespace.
Not sure what you mean. Do you mean when you code in that using statement it tells you no such namespace exists? In that case you need to add the DLL to your project as a reference.
Otherwise I am not sure, post some code and then maybe we can help
|
|
|
|
|
Hi,
how can I change programaticaly the bgColor of my page for example ?
Thanx
|
|
|
|
|
Try using HTML Control and CSS like this:
<script language="VB" runat="server">
Private Sub Page_Load(obj as Object, e as EventArgs)
objBody.Style("background-color")="#cccccc"
End Sub
</script>
<html>
<body id="objBody" runat="server">
<h1>Hello World</h1>
</body>
</html>
Enrico
|
|
|
|
|
Apologies if this is an old question.
My website is hosted on a fairly standard NT setup with ASP (not ASP.net - though I think that is supported as well). The question is, I'd like to permission off a particular area of the web site, how do I do it? I don't have any kind of rights on the box.
The only thing I do have control over is an access db file, and listing the contents of directories. I've looked at the help from my hosts and there doesn't seem to be anything in there
Thanks.
B.
|
|
|
|
|
Barry,
I had met similar problem before. In a hosted environment, we have limited control over securing a portion of the website.
ASP.NET has the solution to secure a folder using setting in web.config, but again some hosting servers only allow web.config file to resides in root folder.
What I did in classic ASP and ASP.NET is to provide login/logout facility to authenticate user. The user credentials are stored in the database. Once the user is authenticated, I stored the authentication info in cookies. Then in the beginning of each web page I want to secure, I call a function to check the cookie and find out whether the current user is authenticated.
This is a hard way but worth to try. If you need some sample codes, just drop me an email.
Enrico
|
|
|
|
|
Enrico,
Thanks for that I've already started doing something similar (when I get the time!) It's only to really protect parts of the site from the casual user so it doesn't have to be perfect!
Thanks,
Barry.
B.
|
|
|
|
|
How can I change the position of controls in my code behind file?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
How can I change the position of controls in my code behind file?
Do you mean the visual position of the HTML elements on the page?
|
|
|
|
|
Paul Watson wrote:
Do you mean the visual position of the HTML elements on the page?
Yes.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
Paul Watson wrote:
Do you mean the visual position of the HTML elements on the page?
Yes.
Ok couple of things (sorry if you know some of this, just going over it to make sure.)
HTML element positioning is not like a Windows app where you can just set the left and top and have it sit wherever you want. By default it is in "flow" mode where each element flows on from the last.
You can however absolutely position elements by using CSS, so overriding the flow behavouir. When you do this to an element it is taken out of the flow of the document and other elements which are not absolutely positioned will act as if that absolute element does not exist when determining their position.
To get an element to position on a left and top basis you need the following CSS styling applied to it: style="position: absolute; top: 100px; left: 100px;"
Also remember that there is a distinct Server side and Client side to a web app. So you cannot have a for loop in the onload event of your ASPX page which moves an element across the page, it won't work as at that point the HTML has not been sent back to the client. You have to use JavaScript on the client-side to do that (or SVG, SMIL etc., but still all on the client-side.)
Of course in your ASPX onload event you can position a control and that position will be displayed to the client. e.g. Label1.top = 20; Label1.left = 20;
In most cases using the CSS method is best and the easiest (and remember rather use a CSS external file rather than the inline style I showed.) However if you need some calculations to determine the position then you can use JavaScript on the client-side or whatever ASP.NET language you choose on the server-side.
If none of the above is what you are looking for, post your code and what you want to do and I can help more
|
|
|
|
|
Thank you Paul.
Paul Watson wrote:
To get an element to position on a left and top basis you need the following CSS styling applied to it: style="position: absolute; top: 100px; left: 100px;"
I use this part and work for me.I find the top and left in the string and change the value of them.So I can change the position.
Paul Watson wrote:
Of course in your ASPX onload event you can position a control and that position will be displayed to the client. e.g. Label1.top = 20; Label1.left = 20;
How can I overriden onload in my ASPX and can I written it in C#?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
How Can I pass TWO parameters two my ASP.NET in Redirect() function? When I put ? in my URL it see all character after it as one parameter.How can I add another one?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Find it out.I have to use &.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I have overriden onload function of body tag in ASP.NET in my aspx.It always load after Page_Load .Is there any event that run before that?I need to do something before Page_Load .
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
What do you need to do that must be done before Page_Load?
The Init function is call before Page_Load
|
|
|
|
|
I want to get clients window size and pass it to sever before page load.I want to set some size and properties of my controls depends on clients browser size,but everythings in code behind first load then java script runs.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Have you looked at HttpRequest.Browser
|
|
|
|
|
Mark Nischalke wrote:
Have you looked at HttpRequest.Browser
Yes .But the client size does not exist there.Are you sure about it?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazy,
You are really going to have to go into some detail.
Is this the same function you wanted to write in javascript? There's no way you can run something on the client before you run Page_Load on the server. The server builds the page, sends it along with any Javascript and the browser picks that up and translates it.
What exactly are you trying to do?
Paul
|
|
|
|
|
Mazdak wrote:
I want to get clients window size and pass it to sever before page load.
The best thing I can think of (and there may be a better way) is to have a "hidden" input field on the form of the previous page then use JavaScript to populate it when the button/link is clicked. Then you should be able to pick that up at the server side.
Paul
|
|
|
|
|
Hi, I need to create an CHM Help System file for my application.
I created some HTML files using MS WORD 2000. In these files there are a lot of jpeg images. Some of them are not displayed on the final chm I cannot figure out why .
Can anyone advise please?
Black ghost
|
|
|
|