|
If I create a class to write the value (so it can be used once when the application starts up and again when the administrator changes this value), I get:
The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?)
in reference to Application.Set(VSDonation.Global.Name1, sValue);
|
|
|
|
|
Use HttpContext.Current.Application to reference the application object.
---
b { font-weight: normal; }
|
|
|
|
|
<smacks forehead="">D'oh!
My class that was trying to access the Application object was not derived from System.Web.UI.Page. Once I added that to the declaration, I can access the Application space.
Thanks. Sorry.
--G
|
|
|
|
|
That's not really a good way to do it, as your class is not a page.
Use HttpContext.Current.Application to access the application object.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks. I've put that in place and it appears to do the trick in a more correct manner.
--G
|
|
|
|
|
Can anyone give me a good reason to not release Debug code for a web site? I hear it's a security risk but since we control the machine I wouldn't think so. If the machine is hacked we have all sorts of issues. I also hear its a performance issue. Any idea on the performance impact? I would rather have the line numbers for exceptions as it makes debugging exceptions eaiser.
|
|
|
|
|
I know, from experience, that debug code is slow... why do you insist on using that?
This is what I do in my web.config so I can see the exceptions only on the server:
<customErrors mode="RemoteOnly" defaultRedirect="error.htm">
</customErrors>
Nila
|
|
|
|
|
|
|
|
Each site is different. You can automate some operations on your site, and do comparisons with the debug and release builds.
|
|
|
|
|
The Debug code give ideas as the site behaves... making easy the hacker work.
On performance issue, Debug code, the asp.net engine must to check the error, face the error against the asp.net error code table, and write a possible solution.
Release code just write a default error page. the second is fastest solution, but, its irrelevant over small sites.
keep Learning and you never will be out of date...
|
|
|
|
|
Hi,
I am trying to abandon the session which started at Login. When I click on Logout, I am redirected to the Login page, which is fine. The problem is, I can still type in the page address that I want in the address bar OR I can click "Back" on the browser and the pages of the site will load without authentication.
What am I doing wrong? Heres the code I have used:
FRONT END<br />
<br />
<pre><'asp:HyperLink runat="server" cssclass="STlvl2" navigateurl="?Logout=1" id="hlLogout">Logout/></pre><br />
CODE BEHIND<br />
<br />
<pre>If Request.QueryString("Logout") = "1" Then
Session.Abandon()
Response.Redirect("../frmLogin.aspx")
End If</pre><br />
<br />
<br />
-- modified at 10:31 Thursday 16th November, 2006
|
|
|
|
|
It may have been a typo, but why is there a ' in the hyperlink?
Also, why do you have a hyperlink that closes the session. Why not abandon the session in the button click event?
|
|
|
|
|
The ' in the hyperlink is so that the code is displayed on this page lol..
I dont actually have ' in my source code.
Secondly, I think I will try to abandon the session by using the btn.click event as you said through a link button. Maybe that will work.
Thanks for the idea mate.
|
|
|
|
|
Hello,
I am calling page2.aspx from Hyperlink field in Grid in page1.aspx and I pass to Page2.aspx 2 parameters. I would like to hide those parameters from the user.
I mean instead of http://MySite.com/page2.aspx?Param1=0&Param2=1
I would like to get http://MySite.com/page2.aspx and also send those 2 parameters to page2.aspx.
I know how to do it if it was not an hyperlink from a grid:
server.transfer "page2.aspx?Param1=0&Param2=1" and it works fine
Thanx
-- modified at 9:20 Thursday 16th November, 2006
Eric H.
|
|
|
|
|
Why not use session vars?
you can also change the hyperlinks to link buttons, then do your server.transfer there.
|
|
|
|
|
The true is that I pass ~20 parameters and I don't think that is a good idea to pass them through session vars.
You suggest to use the linkbutton.
Let me explain and simplify my problem,
I have a gridView with 2 columns: First column is an hyperlink of "item name" and the second column is the string containing "URL" for the first column. The second column is visible=false
The problem is that the URL string is very long and contain ~20 parameters. So when the user click on the link, we can see on the URL a long string, I would like to get the same action than I call to server.transfer.
Perhaps, you have got another idea.
Thanx
-- modified at 2:28 Friday 17th November, 2006
Eric H.
|
|
|
|
|
You can try something like this:
protected void GridView1_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Footer)
{
LinkButton lnkbtn = new LinkButton();
lnkbtn.Text = "Add New";
lnkbtn.CommandName = "Add";
e.Row.Cells(0).Controls.Add(lnkbtn);
}
}
and on the aspx page change the gridview declaration to:
< asp:gridview id="GridView1" runat="server" onrowcreated="GridView1_RowCreated" >
</ asp:gridview >
|
|
|
|
|
Thanx I will try this
Eric H.
|
|
|
|
|
Guys i created a site with Visual Studio 2k5 over windows Xp, one form must create a folder inside the site root folder, this task is sucessfull on developed site, but i fired up a error when the site is running over W2k3. Could you Help me?...
keep Learning and you never will be out of date...
|
|
|
|
|
|
I think so
All the user have all the permissions, i can delete an object (picture) but i cant write a new picture at the same place, the same case with folders.
I using the fileupload control and the command SaveAs..
Any suggest.
-- modified at 11:45 Thursday 16th November, 2006
keep Learning and you never will be out of date...
|
|
|
|
|
Sounds like a create permission problem on the server (if server is Win 2003 the user is NETWORK SERVICE by default). You also may want to set it to create one level down from you website's root. Something like "mywebsite/uploads" or something like that.
Right-click a folder where you want the account to have write permission, choose "Properties" and then Security tab, add the account into user account list, and then set proper permissions to the account.
You may also want to look at impersonation.
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|