|
That doesn't sound right. Are you sure you're checking the correct path, and that your application pool user has at least "read" access to the folder and the files?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
--Yes sir - to the application pool having the correct permission.
However, on the issue of path, can I please explain it a bit?
Let's say our server name is it-server1.
On this server, we have two drives, drive c which looks like this:
LOLCAL DISK(C) and drive e which is set up to look like:
Archive(E).
Inside this Archive (drive E), we have (so far) 4 folders but for some reason, they are called servernames, servername1, servername2, servername3 and servername4.
It appears that these folders are created dynamically. I don't know how because this was set up by vendor.
Then on our database, we have same number of servernames, servername1 through servername4.
I don't know why they are called servernames instead of folders.
The audio files reside on each of these folders.
So, when you click on the Listen link depending the data queried from the database, a servername(folder) is selected and a selected audio file, if exists is selected.
So, the link that plays an audio looks like this:
http//it-server1/archives/folder1(servername1)/filename(audio file).wav
http://it-server1/archives are hardcoded. So is .wav
That's how it looks like on the browser.
|
|
|
|
|
That doesn't seem to match the link from your original question:
http:
You now seem to be navigating directly to the audio file, using a web server on it-server1 . Is that the same server that your code is running on?
Assuming it is the same server, then you'd want something like this:
protected bool RecordingExists(string filename, string servername)
{
string virtualPath = string.Format("/archives/{1}/{0}.wav", filename, servername);
string physicalPath = Server.MapPath(virtualPath);
return System.IO.File.Exists(physicalPath);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you very much sir.
You are so kind and so patient, I really appreciate it.
Yes, that is the server that my code is running on.
I tried exactly this yesterday and I just tried again now and I am still getting the link disabled even when I am 100% sure the link I am clicking on has an audio file on the server.
Does it matter that my app is on C drive (on wwwroot) and the audio files are on E drive?
I can move my app to same E drive if I have to.
|
|
|
|
|
Having the files on a different drive shouldn't make any difference.
Have you checked that the physicalPath variable contains the correct path?
If it still doesn't work, then it must be an NTFS permissions issue. Make sure that IIS_IUSRS has at least "read & execute" access to the folders on the E: drive, and reset the permissions on all child objects.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ok, HUGE progress.
Two problems.
I forgot to include noop_
Sorry about that.
When I included that, the link is now enabled (YEA!!!)
But I am having problem with the second problem.
E drive has the name Archive.
If I use that name on the code, the link is disabled.
However, if I add s as in Archives, the link is enabled.
However, when I click on the link, it displays Archive, removing the s and it gives an error, "file or path cannot be found"
I have got to find a way to change the name Archive on E drive to Archives when the link is clicked so that even though the drive says Archive, it will render as Archives.
Any ideas?
I don't think creating virtual path on the app can solve problem, no?
UPDATE: IT IS WORKING, YEA!!!
I realized the markup has just Archive. I added the 's' and NOW it WORKS!
I can't thank you enough for the many, many times you have come to my rescue.
Thank you very much sir and God bless.
modified 31-May-19 10:32am.
|
|
|
|
|
It sounds like you already have a virtual path /archives/ mapped to E:\Archive\ .
In which case, your URL should look something like:
NavigateUrl='<%# string.Format("/archives/{1}/noop_{0}.wav", Eval("filename"), Eval("servername")) %>'
And the code-behind should look like:
string virtualPath = string.Format("/archives/{1}/noop_{0}.wav", filename, servername);
string physicalPath = Server.MapPath(virtualPath);
return System.IO.File.Exists(physicalPath);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You are coding god!
Just one last question.
On a regular markup, I can add a message when the link is disabled that says something like:
title="No audio exists for this record"
Is there a way to squeeze that message in somewhere?
|
|
|
|
|
Something like this should work:
ToolTip='<%# RecordingExists(Eval("filename", "{0}"), Eval("servername", "{0}")) ? "Play recording" : "No audio exists for this record" %>'
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am getting two errors.
One said The '?' character cannot be used here.
The other error says: syntax error on -> "No audio exists for this record"
|
|
|
|
|
Are you using VB.NET? If so, try:
ToolTip='<%# If(RecordingExists(Eval("filename", "{0}"), Eval("servername", "{0}")), "Play recording", "No audio exists for this record") %>'
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sorry sir, since you presented the code in c# the first time, I didn't want to trouble you with converting to VB. I was doing that instead.
I didn't think it mattered in this last code since it is markup.
Everything is working like we want it.
I am truly grateful.
THANK YOU
|
|
|
|
|
I am trying to deploy my aspnet core application in IIS, and followed the guidelines provided in this [URL]as well as in this[Host ASP.NET Core on Windows with IIS].
When I checked the Eventviewer in the Prod Server, I am getting the error message in Application logs as "Quote: Application 'MACHINE/WEBROOT/APPHOST/TestAppCore20' with physical root 'E:\TestAppCore20\' failed to start process with commandline '%LAUNCHER_PATH% .\TestAppCore20.dll', ErrorCode = '0x80070002' : 0. .
While googling for the above resolution, I foundout one solution [here], but again the same status. Please anybody can have a look and help please?
My web.config is as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="02:00:00"
processPath="%LAUNCHER_PATH%"
arguments=".\TestAppCore20.dll"
stdoutLogEnabled="true"
stdoutLogFile=".\logs\stdout"
forwardWindowsAuthToken="false"
/>
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 97cf335d-efd6-4064-bca2-7a4901141162-->
|
|
|
|
|
The issue was resolved. The issue was with the Web.config. Web.config should be similar as below once deployed to server:
<pre>="1.0"="utf-8"
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,DELETE,PUT" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\yourappName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
<modules runAllManagedModulesForAllRequests="false">
<remove name="WebDAVModule" />
</modules>
</system.webServer>
</location>
</configuration>
|
|
|
|
|
using elliptic curve cryptography hoe to encrypt and decrypt a text
|
|
|
|
|
|
How to import rows from Excel to MS SQL using ASP.net (VB code)?
|
|
|
|
|
|
Greetings again.
Hope this won't be too much of a bother.
I have the following from my gridview:
sp:HyperLinkField DataNavigateUrlFields="filename" headertext="Recording" DataNavigateUrlFormatString="http://Archive/{servername from DB}/play_recording_wav.asp.net?filename='noop_'{0}'.wav" Text="Listen" />
When run, I would like it the url to look like this:
http:
Basically, server1 is value for fieldname called servername, noop_ is hardcoded to filename which is also from the database.
More like this:
c = "archives/"+ '<%# Eval("Servername") %> + "noop_" + Eval("filename") %>' + ".wav"
modified 23-May-19 15:29pm.
|
|
|
|
|
Try:
<asp:HyperLinkField
DataNavigateUrlFields="filename, servername"
DataNavigateUrlFormatString="http://Archive/{1}/play_recording_wav.aspx?filename=noop_{0}.wav"
...
/>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you very much sir.
I really appreciate your help.
|
|
|
|
|
when i saved bookmarks i need to force the user to sign in instead of continuing with the application for safety and security. can you please share the code that i can use.
|
|
|
|
|
Its hard to predict in my knowledge to check if user accessing your application from bookmark link. Also, are you not killing your active sessions? So when user bookmark your application link and comes back after some time/day that session is gone and he has to re-login again? What is your strategy to establish session with user on login?
modified 20-Sep-20 21:01pm.
|
|
|
|
|
Sir
I am using VB.Net 2008 and i want to creat user registration page where i want to send user confirmation OTP via email during the user registration.please guide me with code using vb.net 2008 in developing asp web.
|
|
|
|
|