|
You can use Request.ServerVariables("SCRIPT_NAME"). That will return "/folder1/folder2/filename.aspx". Use LastIndexOf to find the last slash and extract the portion of the string that you need.
|
|
|
|
|
I was just wondering what everyone thinks about ViewState in ASP.NET. Yes - it saves a lot of coding, but it adds a lot of bulk to a page.
I just whipped up a quick form with a button, 2 drop lists (4 options each) and a text box. The viewstate was 5.6Kb. Ouch.
Will developers rely on viewstate, or will most disable able it and add the 3 lines of code each time to save download times for their users?
cheers,
Chris Maunder
|
|
|
|
|
I suppose the true answer is always that depends. As we see network throughput increasing rapidly, the issue of page size tends to decrease. As we all want to have our pages display as fast as possible, there is always an issue of design that comes into play. I recently (...past few months) have been working on an intranet application where the default page will load and "hide" 50 different div tags, within each of those I have 3 input boxes and a textarea box. Would I have appreciated the ViewState in this circumstance, YES, but is the overhead worth it, in this case probably not.
Nick Parker
|
|
|
|
|
ViewState seems really good for intranet apps where bandwidth isn't an issue, but for an internet app i think I would over ride the Save/Load Viewstate methods on my controls and use the session object instead to save the download time.
Of course I haven't actually practiced that principle yet, but it theory it should work well, once you get around what you would name everything
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
sir,
i have to read files kept on server.i have created handle for these files but am unable to read them .it just get stuck at getfolder method.do i need to have some permissions to access getfolder method.please advise me step by step.
thanx in advance.
kukum.
|
|
|
|
|
As I know you only need to have read access, but since it is on the web you already have it
Of course, if you are trying to get files/folders somewhere out of the web directory, you need this folder to have read permissions for "Everyone" or to be exact - "IUSR_..." (Internet Guest Account)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Ok, I give, I'm experimenting with C#/asp.net and code behinds. What I'm trying to do is to have my asp.net page buttons open up a new browser and would like to send my PDF file to that window. I have no problems sending my content to my current window but not a new one.
I'm looking for a pure C# solution. (I have easily done this with jscript before).
Thanks,
Nick
|
|
|
|
|
Hi all,
I am a VC++ programmer and don't have experience in ASP. But now I am learning ASP.Net. These days I am trying to write a online Tetris game using ASP.Net technology.
At first I wanted to write a server control derived from System.Web.UI.WebControls.WebControl.Tetris game is encapsulated in this control and then can be put in any aspx page. However, I found in order to let the blocks move I have to depend on the server control to change the output html(I just use a html table to implement the interface of the game now)constantly. Then I realized that maybe using a server control is not a good idea in this problem. So now I think maybe I still need some client-side script to implement the moving of the blocks.
Since I don't know much ASP and just begin learning ASP.Net, I am not sure if I am on the right track to solve this kind of problem. Could anyone here give me any hints? And I want to know what is the best way to write a online game like Tetris by using ASP.Net technology?
Thanks a lot!
Sherry
|
|
|
|
|
Well, can't help you with ASP.Net, but for sure you don't need to use any server side scripting. All code should be a client side, and at this point you don't need to know ASP, only Javascript. You may use ASP for storing scores for example
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
when I select the value does not stay or highlighted
<title>Untitled Document
function onlyOneProvide(oForm, oFormEl, oFormElHidden)
{
var sTempValue
var sTempType
if (oFormEl.type == 'select-one')
{
sTempValue = oFormEl.selectedIndex
sTempType = 'select-one'
}
if (oFormEl.type == 'text')
{
sTempValue = oFormEl.value
sTempType = 'text'
}
oForm.reset()
if (sTempType == 'select-one')
{
oFormEl.selectedIndex = sTempValue
//alert('the sTempValue'+sTempValue)
oFormElHidden.value = findSelected(oFormEl)
}
if (sTempType == 'text')
{
oFormEl.value = sTempValue
oFormElHidden.value = sTempValue
}
}
function findSelected(oFormEl)
{
var sValue = ''
if (typeof(oFormEl) == "object")
{
sValue = oFormEl.options[oFormEl.selectedIndex].value
alert(sValue);
}
return(sValue)
}
select-one
TWIG (41451)
Stone Fox - A Dog Gone Good (41407)
Letters to the King (41405)
Finance Project (37166)
Voyages en français (41352)
Histoires amusantes (41255)
Cut a Label (41221)
Class China Website (41194)
Making Choices (41146)
Tweety Birds (41127)
Alberta-Oklahoma Music Connection (40499)
All About Me Student Portfolios (40498)
Zoom! The Fastest Vehichle WebQuest! (34306)
Monthly Muir Lake Thematic Couplet Riddles (35885)
Media and Society (41246)
|
|
|
|
|
Sir.
When i update the session variable with new value. It always give me old value.But when i refresh the browser then i get new value.
How will i get new Value of session variable immediatly without refreshing browser in ASP
|
|
|
|
|
The session values are updated whenever they are set, you probably have your setting code located below the displaying code which is why you don't see that.
James
Sonork: Hasaki
"I left there in the morning
with their God tucked underneath my arm
their half-assed smiles and the book of rules.
So I asked this God a question
and by way of firm reply,
He said - I'm not the kind you have to wind up on Sundays."
"Wind Up" from Aqualung, Jethro Tull 1971
|
|
|
|
|
How would I stop text selection from occuring...?
I have created a div which can be dragged around the screen but would to prevent people from being able to select text...?
DHTML Central has little div's that act like Windows windows...you can drag them around but cannot select the caption text.
Any ideas...?
Ondragover
Ondragstop...?
Thanx~!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
onSelectStart=return false;
Example: try to select me
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Totally sweet...
Thats it...awesome...nothing fancy and super easy to add to my exiting projects...
However I would have to add this handler to all my elements that I don't want selected...?
I could do it globally with the folliwng:
document.OnSelectStart="return false;"
This would be doucment wide now correct...?
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Sir.
When i firstly set one value to session variable i can eaisly access that value from session variable. but when i reintialize it again new value to the same variable i get old value.When i refresh the Browser then i get new Value .
how i will get new value without refresh the browser from session variable.
|
|
|
|
|
I would think refresh is the only way to do it. cookies are cached on the client and would require another http request to update I think...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi guys
I cant seem to create my own name for C# web services it give it a default name of webservice1, 2, 3 etc
I have seen in screenshots you can do it, but the edit box is disabled with the default name in it
Have i set it up wrong?
its the release version Prof
Wudan MAster
|
|
|
|
|
Does anyone know if it is possible to populate a Dropdown on a Form using an ISAPI extension? If so, how?
Maybe like:
<form action="Handler.asp?A_Value?" method="POST" name="MyForm">
<SELECT id=select1 name=select1>
<script src="http://thisServer/dlls/isapi003.dll"></script>
</SELECT>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
and then, in the extension dll:
void CISAPI003Extension::Default(CHttpServerContext* pCtxt)
{
*pCtxt << _T("<OPTION>value1</OPTION>");
*pCtxt << _T("<OPTION>value2</OPTION>");
*pCtxt << _T("<OPTION>value3</OPTION>");
}
Should this work or should I be approaching this an entirely different way, given my limited and totally inadequate knowledge and experience in Web development stuff.
I would appreciate any help here.
Many thanks.
code dope.
|
|
|
|
|
Well, in your case you will get an error. But look at ISAPI extension just like at another ASP file, which you are executing. Of course it is not the same, but same idea.
In the example you provided you will get such code as it will see the end-user:
<script src="http://thisServer/dlls/isapi.dll">
<option>value1</option>
<option>value2</option>
<option>value3</option>
<script>
And this is actually not a script. You need to output a working Javascript here, which will add options into your select. Here is an example:
void CISAPI003Extension::Default(CHttpServerContext* pCtxt)
{
*pCtxt << _T("select1.options[select1.options.length] = new Option(...);");
}
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Thanx for the reply.
Yes, that worked fine. I suppose I really ought to get a good book on JavaScript instead of just trying to learn it as I go along. This is my first Web project so I'm not really used to working with so many different "languages" at once - HTML, JavaScript, ASP, ISAPI and geting my head around how they come together has not been easy. I usually work with C++ (MFC) with a bit of SQL.
Thanx again.
code dope.
|
|
|
|
|
Hi guys, this should be a simple one. I've just dived into ASP .NET via Visual Studio .NET. First thing I did was drop a panel with a few radio buttons in it onto a web form and populated their OnCheckChanged event handlers. I then put a breakpoint in there. But when I try to break into that code, it simply doesn't. I experimented with a button control and I'm able to break into the ButtonClicked event handler. I checked my debug configurations as per MSDN but all seems in order there.
I must be missing something very trivial but I can't figure it out just now.
Regards
Senkwe
Just another wannabe code junky
|
|
|
|
|
When working w/client side cookies (Jscript) how would I over write a cookie...?
document.cookie = "Person=John Doe; Address=One Elgin"
If I wanted to over write this cookie would the following do the trick?
document.cookie = "Person=John Dope; Address=One Elgin"
Does this replace the existing cookie, or just add another almost identical cookie...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
|
Sweet...All I needed to hear...
Same domain yup...
I'm not specifiying any default's
No shttp, domain, path...nothing, just name=value pairs and the date of course.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|