Wednesday, March 28, 2012
Trouble creating new directory
I am using c# and running a site that is on a shared
host. The code in question is supposed to create a new
directory that is coming out of a text box.
It works fine on my computer, but I get the following
stack trace:
System.IO.DirectoryNotFoundException: Could not find a
part of the path "D:\". at System.IO.__Error.WinIOError
(Int32 errorCode, String str) at
System.IO.Directory.InternalCreateDirectory(String
fullPath, String path) at System.IO.DirectoryInfo.Create
() at testapps.createdir.CreateSubDirectory(String direc)
The code to create is as follows:
public bool CreateSubDirectory(string direc)
{
bool returnStatus = false;
DirectoryInfo di = new DirectoryInfo(@dotnet.itags.org.direc);
if(di.Exists)
{
Trace.Write("Directory exists " +
di.FullName);
this.Label1.Text = "Directory exists";
}
else
{
Trace.Write("Directory does not exist " +
di.FullName);
this.Label1.Text = "Directory does not
exists";
try
{
di.Create();
if(di.Exists)
{
Trace.Write("Directory exists
after creating it");
this.Label1.Text += "Directory
exists after creating it";
}
}
catch(Exception ex)
{
this.Label1.Text += "Error trying to
create directory that did not exist " + ex.ToString();
Trace.Write("Error creating directory
that does not exist " + ex);
}
}
return returnStatus;
}
Any ideas or suggestions, it works great on my local
machine?
Sheldon Cohen
shelman2@dotnet.itags.org.hotmail.comThis may be a misnomer of an error, but I think the root of your problem (no
pun intended) is that you don't have permissions to get at data outside of
your configured directory on the Host server. Imagine if you could - you can
probe the entire server and scavage all the other site's files which would
be a bit of a security risk to say the least.
+++ Rick --
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
-----------
Making waves on the Web
"Sheldon Cohen" <shelman2@.hotmail.com> wrote in message
news:2db7501c394e2$8cb6dd20$a601280a@.phx.gbl...
> Hello,
> I am using c# and running a site that is on a shared
> host. The code in question is supposed to create a new
> directory that is coming out of a text box.
> It works fine on my computer, but I get the following
> stack trace:
> System.IO.DirectoryNotFoundException: Could not find a
> part of the path "D:\". at System.IO.__Error.WinIOError
> (Int32 errorCode, String str) at
> System.IO.Directory.InternalCreateDirectory(String
> fullPath, String path) at System.IO.DirectoryInfo.Create
> () at testapps.createdir.CreateSubDirectory(String direc)
> The code to create is as follows:
> public bool CreateSubDirectory(string direc)
> {
> bool returnStatus = false;
> DirectoryInfo di = new DirectoryInfo(@.direc);
> if(di.Exists)
> {
> Trace.Write("Directory exists " +
> di.FullName);
> this.Label1.Text = "Directory exists";
> }
> else
> {
> Trace.Write("Directory does not exist " +
> di.FullName);
> this.Label1.Text = "Directory does not
> exists";
> try
> {
> di.Create();
> if(di.Exists)
> {
> Trace.Write("Directory exists
> after creating it");
> this.Label1.Text += "Directory
> exists after creating it";
> }
> }
> catch(Exception ex)
> {
> this.Label1.Text += "Error trying to
> create directory that did not exist " + ex.ToString();
> Trace.Write("Error creating directory
> that does not exist " + ex);
> }
> }
> return returnStatus;
> }
> Any ideas or suggestions, it works great on my local
> machine?
> Sheldon Cohen
> shelman2@.hotmail.com
Thanks, that makes sense. I have contacted my host and they do not have
a clue what to do. Any suggestions of how I could get this working?
Thanks,
Sheldon Cohen
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Thanks, that makes sense. I have contacted my host and they do not have
a clue what to do. Any suggestions of how I could get this working?
Thanks,
Sheldon Cohen
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
What do you need access to the root for?
Basically your domain probably runs under a specific user account they've
set up for you. That username needs rights to access the directories you
want to access. Since htey lock it down they should have a clue what to do
<g>...
+++ Rick --
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
-----------
Making waves on the Web
"Sheldon Cohen" <shelman2@.hotmail.com> wrote in message
news:uMQNpQSlDHA.3504@.TK2MSFTNGP11.phx.gbl...
> Thanks, that makes sense. I have contacted my host and they do not have
> a clue what to do. Any suggestions of how I could get this working?
> Thanks,
> Sheldon Cohen
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
What do you need access to the root for?
Basically your domain probably runs under a specific user account they've
set up for you. That username needs rights to access the directories you
want to access. Since htey lock it down they should have a clue what to do
<g>...
+++ Rick --
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
-----------
Making waves on the Web
"Sheldon Cohen" <shelman2@.hotmail.com> wrote in message
news:uMQNpQSlDHA.3504@.TK2MSFTNGP11.phx.gbl...
> Thanks, that makes sense. I have contacted my host and they do not have
> a clue what to do. Any suggestions of how I could get this working?
> Thanks,
> Sheldon Cohen
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Hi, thanks for responding back to my message.
I don't need root access I think, I am just trying to create a new
directory for each new user that matches a username they choose while
signing up from our website. We create a new jad file which is for their
java enabled cell phone. We are able to create the file using
StreamWriter and File.Create(), only the directory is giving us trouble.
The hosting company is not sure when we called them, they said they were
researching it. I have tried to use the
\\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
System.IO.DirectoryNotFoundException: Could not find a
part of the path "D:\". at System.IO.__Error.WinIOError
(Int32 errorCode, String str) at
System.IO.Directory.InternalCreateDirectory(String
fullPath, String path) at System.IO.DirectoryInfo.Create
() at testapps.createdir.CreateSubDirectory(String direc)
We are really not sure what to do next. Seems like the
d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
use the File.Create(PATH) does not work here.
Thanks for all the help so far, any more would be great.
Sheldon Cohen
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Hi, thanks for responding back to my message.
I don't need root access I think, I am just trying to create a new
directory for each new user that matches a username they choose while
signing up from our website. We create a new jad file which is for their
java enabled cell phone. We are able to create the file using
StreamWriter and File.Create(), only the directory is giving us trouble.
The hosting company is not sure when we called them, they said they were
researching it. I have tried to use the
\\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
System.IO.DirectoryNotFoundException: Could not find a
part of the path "D:\". at System.IO.__Error.WinIOError
(Int32 errorCode, String str) at
System.IO.Directory.InternalCreateDirectory(String
fullPath, String path) at System.IO.DirectoryInfo.Create
() at testapps.createdir.CreateSubDirectory(String direc)
We are really not sure what to do next. Seems like the
d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
use the File.Create(PATH) does not work here.
Thanks for all the help so far, any more would be great.
Sheldon Cohen
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
I think the problem may be share permissions. I had this problem once myself
where the root directory required directory read access or else shares
weren't accessible. I can't remember the details now exactly, but ultimately
it ended up being that I added EveryOne with directory read rights on the
root dir...
Bummer that htis is at an ISP which will make experimenting and trying to
find this issue a lot more work than if you can try it yourself <g
+++ Rick --
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
-----------
Making waves on the Web
"Sheldon Cohen" <shelman2@.hotmail.com> wrote in message
news:ezyH6tylDHA.2652@.TK2MSFTNGP09.phx.gbl...
> Hi, thanks for responding back to my message.
> I don't need root access I think, I am just trying to create a new
> directory for each new user that matches a username they choose while
> signing up from our website. We create a new jad file which is for their
> java enabled cell phone. We are able to create the file using
> StreamWriter and File.Create(), only the directory is giving us trouble.
> The hosting company is not sure when we called them, they said they were
> researching it. I have tried to use the
> \\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
> System.IO.DirectoryNotFoundException: Could not find a
> part of the path "D:\". at System.IO.__Error.WinIOError
> (Int32 errorCode, String str) at
> System.IO.Directory.InternalCreateDirectory(String
> fullPath, String path) at System.IO.DirectoryInfo.Create
> () at testapps.createdir.CreateSubDirectory(String direc)
> We are really not sure what to do next. Seems like the
> d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
> use the File.Create(PATH) does not work here.
> Thanks for all the help so far, any more would be great.
> Sheldon Cohen
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
I think the problem may be share permissions. I had this problem once myself
where the root directory required directory read access or else shares
weren't accessible. I can't remember the details now exactly, but ultimately
it ended up being that I added EveryOne with directory read rights on the
root dir...
Bummer that htis is at an ISP which will make experimenting and trying to
find this issue a lot more work than if you can try it yourself <g
+++ Rick --
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
-----------
Making waves on the Web
"Sheldon Cohen" <shelman2@.hotmail.com> wrote in message
news:ezyH6tylDHA.2652@.TK2MSFTNGP09.phx.gbl...
> Hi, thanks for responding back to my message.
> I don't need root access I think, I am just trying to create a new
> directory for each new user that matches a username they choose while
> signing up from our website. We create a new jad file which is for their
> java enabled cell phone. We are able to create the file using
> StreamWriter and File.Create(), only the directory is giving us trouble.
> The hosting company is not sure when we called them, they said they were
> researching it. I have tried to use the
> \\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
> System.IO.DirectoryNotFoundException: Could not find a
> part of the path "D:\". at System.IO.__Error.WinIOError
> (Int32 errorCode, String str) at
> System.IO.Directory.InternalCreateDirectory(String
> fullPath, String path) at System.IO.DirectoryInfo.Create
> () at testapps.createdir.CreateSubDirectory(String direc)
> We are really not sure what to do next. Seems like the
> d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
> use the File.Create(PATH) does not work here.
> Thanks for all the help so far, any more would be great.
> Sheldon Cohen
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Trouble deploying ASP.NET application
Server has directory running as a ASP.NET application.
If I take out ...Inherits="quizengine.WebForm1"...the page loads but no
functionality... of course becuase I have code behind on it.
My problem is extreemly basic. Make an application on my machine, then
publish to host, fire application and I get the following error.
I am completely lost and totally stunned how hard it is to get information
on how to deploy a standard ASP.NET application with no odd settings or
database onto a host server!
Server Error in '/quiz' Application.
------------------------
The remote server returned an error: (404) Not Found.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an
error: (404) Not Found.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[WebException: The remote server returned an error: (404) Not Found.]
System.Net.HttpWebRequest.CheckFinalStatus() +680
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) +139
System.Net.HttpWebRequest.GetResponse() +249
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
credentials) +65
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +94
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
ofObjectToReturn) +55
System.Xml.XmlTextReader.CreateScanner() +384
System.Xml.XmlTextReader.Init() +23
System.Xml.XmlTextReader.Read() +530
System.Xml.XmlReader.MoveToContent() +75
System.Data.DataSet.ReadXmlSchema(XmlReader reader, Boolean
denyResolving) +122
System.Data.DataSet.ReadXmlSchema(String fileName) +60
quizengine.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\quizengine\default.aspx.cs:25
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
-
------------------------problem solved!
although I need to use a full path for my local host directory to access my
XML files for some bizare reason I thought I could just put the file name
only when I deployed it to the host. Once I put the full path name of my host
server..problem gone.
Now I can work on the other problems.
"Sean" wrote:
> Tried both FTP and frontpage extensions method to the host server.
> Server has directory running as a ASP.NET application.
> If I take out ...Inherits="quizengine.WebForm1"...the page loads but no
> functionality... of course becuase I have code behind on it.
> My problem is extreemly basic. Make an application on my machine, then
> publish to host, fire application and I get the following error.
> I am completely lost and totally stunned how hard it is to get information
> on how to deploy a standard ASP.NET application with no odd settings or
> database onto a host server!
>
> Server Error in '/quiz' Application.
> ------------------------
> The remote server returned an error: (404) Not Found.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information about
> the error and where it originated in the code.
> Exception Details: System.Net.WebException: The remote server returned an
> error: (404) Not Found.
> Source Error:
> An unhandled exception was generated during the execution of the current web
> request. Information regarding the origin and location of the exception can
> be identified using the exception stack trace below.
> Stack Trace:
>
> [WebException: The remote server returned an error: (404) Not Found.]
> System.Net.HttpWebRequest.CheckFinalStatus() +680
> System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) +139
> System.Net.HttpWebRequest.GetResponse() +249
> System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
> credentials) +65
> System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
> credentials) +94
> System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
> ofObjectToReturn) +55
> System.Xml.XmlTextReader.CreateScanner() +384
> System.Xml.XmlTextReader.Init() +23
> System.Xml.XmlTextReader.Read() +530
> System.Xml.XmlReader.MoveToContent() +75
> System.Data.DataSet.ReadXmlSchema(XmlReader reader, Boolean
> denyResolving) +122
> System.Data.DataSet.ReadXmlSchema(String fileName) +60
> quizengine.WebForm1.Page_Load(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\quizengine\default.aspx.cs:25
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +750
> -
> ------------------------
>
Trouble deploying ASP.NET application
Server has directory running as a ASP.NET application.
If I take out ...Inherits="quizengine.WebForm1"...the page loads but no
functionality... of course becuase I have code behind on it.
My problem is extreemly basic. Make an application on my machine, then
publish to host, fire application and I get the following error.
I am completely lost and totally stunned how hard it is to get information
on how to deploy a standard ASP.NET application with no odd settings or
database onto a host server!
Server Error in '/quiz' Application.
----
--
The remote server returned an error: (404) Not Found.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information abou
t
the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an
error: (404) Not Found.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[WebException: The remote server returned an error: (404) Not Found.]
System.Net.HttpWebRequest.CheckFinalStatus() +680
System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +139
System.Net.HttpWebRequest.GetResponse() +249
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
credentials) +65
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
credentials) +94
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
ofObjectToReturn) +55
System.Xml.XmlTextReader.CreateScanner() +384
System.Xml.XmlTextReader.Init() +23
System.Xml.XmlTextReader.Read() +530
System.Xml.XmlReader.MoveToContent() +75
System.Data.DataSet.ReadXmlSchema(XmlReader reader, Boolean
denyResolving) +122
System.Data.DataSet.ReadXmlSchema(String fileName) +60
quizengine.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\quizengine\default.aspx.cs:25
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
-
----
--problem solved!
although I need to use a full path for my local host directory to access my
XML files for some bizare reason I thought I could just put the file name
only when I deployed it to the host. Once I put the full path name of my hos
t
server..problem gone.
Now I can work on the other problems.
"Sean" wrote:
> Tried both FTP and frontpage extensions method to the host server.
> Server has directory running as a ASP.NET application.
> If I take out ...Inherits="quizengine.WebForm1"...the page loads but no
> functionality... of course becuase I have code behind on it.
> My problem is extreemly basic. Make an application on my machine, then
> publish to host, fire application and I get the following error.
> I am completely lost and totally stunned how hard it is to get informatio
n
> on how to deploy a standard ASP.NET application with no odd settings or
> database onto a host server!
>
> Server Error in '/quiz' Application.
> ----
--
> The remote server returned an error: (404) Not Found.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information ab
out
> the error and where it originated in the code.
> Exception Details: System.Net.WebException: The remote server returned an
> error: (404) Not Found.
> Source Error:
> An unhandled exception was generated during the execution of the current w
eb
> request. Information regarding the origin and location of the exception ca
n
> be identified using the exception stack trace below.
> Stack Trace:
>
> [WebException: The remote server returned an error: (404) Not Found.]
> System.Net.HttpWebRequest.CheckFinalStatus() +680
> System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +139
> System.Net.HttpWebRequest.GetResponse() +249
> System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials
> credentials) +65
> System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials
> credentials) +94
> System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type
> ofObjectToReturn) +55
> System.Xml.XmlTextReader.CreateScanner() +384
> System.Xml.XmlTextReader.Init() +23
> System.Xml.XmlTextReader.Read() +530
> System.Xml.XmlReader.MoveToContent() +75
> System.Data.DataSet.ReadXmlSchema(XmlReader reader, Boolean
> denyResolving) +122
> System.Data.DataSet.ReadXmlSchema(String fileName) +60
> quizengine.WebForm1.Page_Load(Object sender, EventArgs e) in
> c:\inetpub\wwwroot\quizengine\default.aspx.cs:25
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +750
> -
> ----
--
>
>
Monday, March 26, 2012
trouble getting FileSystemWatcher to work
I am doing an example in my MSPress MCTS 70-536 book which uses FileSystemWatcher to see if a file is created or deleted in a directory.
However, it doesn't work since it is a console application and the program ends i.e. stops monitoring events, so it can never respond to an added/deleted file.
I tried to put it in an endless loop that it didn't work, either, never noticed a created file.
What am I missing?
How can I get FileSystemWatcher to work in a console application? Is it possible, the book seems to think so.
Thanks,
1class Program2 {3static void Main(string[] args)4 {56 FileSystemWatcher watcher =new FileSystemWatcher();7 watcher.Path = @dotnet.itags.org."c:\";89//register10 watcher.Created +=new FileSystemEventHandler(watcher_Changed);11 watcher.Deleted +=new FileSystemEventHandler(watcher_Changed);1213//start14 watcher.EnableRaisingEvents =true;1516 }1718static void watcher_Changed(object sender, FileSystemEventArgs e)19 {20 Console.WriteLine("here");21 }22 }Hi Aubrey,
I'm guessing you were probably having trouble because the application you created was using a "busy" loop which effectively blocked the ability of other threads to execute. I was able to get good results by using a loop at the end of Main() that contained a long call to Thread.Sleep(), like this:
while (true)
{
System.Threading.Thread.Sleep(60000);
}
HTH,
Clay
can u explain the use of File system watcher. I wanted to know more about it
thanks
vikram
Vikram's Blog
Trouble opening an existing web application
Visual Studio cannot create or open the application. The likeliest problem is that required components are not installed to the local web server. Run visual studio .NET setup and add the web development tool.
Saturday, March 24, 2012
Trouble with a page loading when xcopying from localhost to server!
Can you post the html markup?
There is a form tag in the html, but here it is:
Date of Request:Ext.:IS Request #:Originator:Dept Manager:Upload Bulletins
Please select a brandPlease select bulletins to upload for emailing. Note: Uploaded files must be MS Word files. Select Product Bulletin Type
there is a form tag... here is code
It worked locally not on development server..
. Date of Request:Ext.:IS Request #:Originator:Dept Manager:Upload Bulletins
Please select a brandPlease select bulletins to upload for emailing. Note: Uploaded files must be MS Word files. Select Product Bulletin Type
I'm sorry, I meant to post you aspx code for the page. Sorry, I didn't notice that you said you had a <form tag.
You say that another page is working. does it have any server controls on it?
Hey Jim,
Sorry about the double post, I'm new to this forum.. I believe its a sql connection problem. OR not? Here is the code for the connection:
'This will access a SQL database and retreive users name, ext, dept, ID.
Dim cnAsNew SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ProductBulletins;Data Source=SERVER") <-generic server
Dim cmdAs SqlCommand
Dim dr As SqlDataReader
Try
cn.Open()
cmd = New SqlCommand("usp_SELECTBYUSERNAME", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@.username", user)
dr = cmd.ExecuteReader(CommandBehavior.SingleRow)
dr.Read()
lblOriginator.Text = dr.Item("FirstName") + " " + dr.Item("LastName")
lblExt.Text = dr.Item("Extension")
lblDeptManager.Text = dr.Item("Department")
userID = dr.Item("ID")
Catch ex As Exception
Response.Redirect("ErrorSuccess.aspx?Err=1" + Context.Server.GetLastError.Message)
Finally
dr.Close()
cn.Close()
EndTry
EndSub
Thursday, March 22, 2012
Trouble with forms authentication
am using the "Location" tag to specify the directory to be protected. The
login.aspx page is in the root directory of the app. Here is the web.config:
<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="Admin" password="pass"/>
<user name="Ashlyinn" password="pass"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
The problem is event if I put in the proper valid credentials authorization
fails.
Any suggestions?
Thanks, Justin.Hey Justin,
When u mean authorization do u mean th user can login but he is not
getting the appropriate resources?
That means is he authenticated?
"Justin" wrote:
> I am trying to password protect a subdirectory using forms authentication.
I
> am using the "Location" tag to specify the directory to be protected. The
> login.aspx page is in the root directory of the app. Here is the web.confi
g:
> <location path="Admin">
> <system.web>
> <authentication mode="Forms">
> <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="
30">
> <credentials passwordFormat="Clear">
> <user name="Admin" password="pass"/>
> <user name="Ashlyinn" password="pass"/>
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?"/>
> </authorization>
> </system.web>
> </location>
> The problem is event if I put in the proper valid credentials authorizatio
n
> fails.
> Any suggestions?
> Thanks, Justin.
No, the user is not authenticated at all, meaning it goes to the else
statement in the code below no matter what:
private void Login_Click(object sender, System.EventArgs e)
{
if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
{
FormsAuthentication.RedirectFromLoginPage(Email.Text, false);
}
else
{
lblStatus.Text = "Authentication Failed.";
}
}
"Patrick.O.Ige" wrote:
> Hey Justin,
> When u mean authorization do u mean th user can login but he is no
t
> getting the appropriate resources?
> That means is he authenticated?
>
> "Justin" wrote:
>
Ok Justin so No authentication at al!!
Are u sure u have all the right settings?
First check to see whether u have Anonymous Auth checked in IIS.
Got to ur WebServer and right click on ur Virtual Directory of ur
Application >Go to Properties >Directory security TAB> On the Anonymouse
Access and Auth control
click EDIT and make sure u check Anonymous access!
Also make sure u have :- <identity impersonate="true" /> placed in ur
web.config
Try all that!
Let me know if it works for u..if not post ur Question.
"Justin" wrote:
> No, the user is not authenticated at all, meaning it goes to the else
> statement in the code below no matter what:
> private void Login_Click(object sender, System.EventArgs e)
> {
> if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> {
> FormsAuthentication.RedirectFromLoginPage(Email.Text, false);
> }
> else
> {
> lblStatus.Text = "Authentication Failed.";
> }
> }
>
> "Patrick.O.Ige" wrote:
>
Well, unfortunetly it still does not work. I am sure its something simle but
sometimes simple problems are hard to fix.
Thanks for the help.
Justin.
"Patrick.O.Ige" wrote:
> Ok Justin so No authentication at al!!
> Are u sure u have all the right settings?
> First check to see whether u have Anonymous Auth checked in IIS.
> Got to ur WebServer and right click on ur Virtual Directory of ur
> Application >Go to Properties >Directory security TAB> On the Anonymouse
> Access and Auth control
> click EDIT and make sure u check Anonymous access!
> Also make sure u have :- <identity impersonate="true" /> placed in ur
> web.config
> Try all that!
> Let me know if it works for u..if not post ur Question.
>
> "Justin" wrote:
>
Just try looking through ur code carefully ok!
Justin try looking through:-Forms Authentication here:-
http://samples.gotdotnet.com/quickstart/aspplus/
or
http://support.microsoft.com/defaul...r />
0&SD=MSDN
or
http://www.costudio.com/form_auth.asp
"Justin" wrote:
> Well, unfortunetly it still does not work. I am sure its something simle b
ut
> sometimes simple problems are hard to fix.
> Thanks for the help.
> Justin.
> "Patrick.O.Ige" wrote:
>
This link shoud help for sure:-
http://www.15seconds.com/issue/020220.htm
And by the way in ur Web.Config why don't u do:-
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="login.aspx"
protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="jeff" password="test" />
<user name="mike" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
And then if u want to perform Auhtorization use the location PATH and specif
y
whch users can see access contents of a particular FOLDER!
GDLUCK
"Patrick.O.Ige" wrote:
> Just try looking through ur code carefully ok!
> Justin try looking through:-Forms Authentication here:-
> http://samples.gotdotnet.com/quickstart/aspplus/
> or
> http://support.microsoft.com/defaul.../>
240&SD=MSDN
> or
> http://www.costudio.com/form_auth.asp
>
>
> "Justin" wrote:
>
Ok, I am getting closer to getting this to work the only problem is that
after loging in it redirects to default.aspx in the root directory instead o
f
admin/default.aspx.
How do I manualy set redirect url?
"Patrick.O.Ige" wrote:
> This link shoud help for sure:-
> http://www.15seconds.com/issue/020220.htm
> And by the way in ur Web.Config why don't u do:-
> <configuration>
> <system.web>
> <customErrors mode="Off"/>
> <authentication mode="Forms">
> <forms name="appNameAuth" path="/" loginUrl="login.aspx"
> protection="All" timeout="30">
> <credentials passwordFormat="Clear">
> <user name="jeff" password="test" />
> <user name="mike" password="test" />
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?" />
> </authorization>
> </system.web>
> </configuration>
> And then if u want to perform Auhtorization use the location PATH and spec
ify
> whch users can see access contents of a particular FOLDER!
> GDLUCK
>
>
> "Patrick.O.Ige" wrote:
>
Trouble with forms authentication
am using the "Location" tag to specify the directory to be protected. The
login.aspx page is in the root directory of the app. Here is the web.config:
<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="Admin" password="pass"/>
<user name="Ashlyinn" password="pass"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location
The problem is event if I put in the proper valid credentials authorization
fails.
Any suggestions?
Thanks, Justin.Hey Justin,
When u mean authorization do u mean th user can login but he is not
getting the appropriate resources?
That means is he authenticated?
"Justin" wrote:
> I am trying to password protect a subdirectory using forms authentication. I
> am using the "Location" tag to specify the directory to be protected. The
> login.aspx page is in the root directory of the app. Here is the web.config:
> <location path="Admin">
> <system.web>
> <authentication mode="Forms">
> <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> <credentials passwordFormat="Clear">
> <user name="Admin" password="pass"/>
> <user name="Ashlyinn" password="pass"/>
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?"/>
> </authorization>
> </system.web>
> </location>
> The problem is event if I put in the proper valid credentials authorization
> fails.
> Any suggestions?
> Thanks, Justin.
No, the user is not authenticated at all, meaning it goes to the else
statement in the code below no matter what:
private void Login_Click(object sender, System.EventArgs e)
{
if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
{
FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
}
else
{
lblStatus.Text = "Authentication Failed.";
}
}
"Patrick.O.Ige" wrote:
> Hey Justin,
> When u mean authorization do u mean th user can login but he is not
> getting the appropriate resources?
> That means is he authenticated?
>
> "Justin" wrote:
> > I am trying to password protect a subdirectory using forms authentication. I
> > am using the "Location" tag to specify the directory to be protected. The
> > login.aspx page is in the root directory of the app. Here is the web.config:
> > <location path="Admin">
> > <system.web>
> > <authentication mode="Forms">
> > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > <credentials passwordFormat="Clear">
> > <user name="Admin" password="pass"/>
> > <user name="Ashlyinn" password="pass"/>
> > </credentials>
> > </forms>
> > </authentication>
> > <authorization>
> > <deny users="?"/>
> > </authorization>
> > </system.web>
> > </location>
> > The problem is event if I put in the proper valid credentials authorization
> > fails.
> > Any suggestions?
> > Thanks, Justin.
Ok Justin so No authentication at al!!
Are u sure u have all the right settings?
First check to see whether u have Anonymous Auth checked in IIS.
Got to ur WebServer and right click on ur Virtual Directory of ur
Application >Go to Properties >Directory security TAB> On the Anonymouse
Access and Auth control
click EDIT and make sure u check Anonymous access!
Also make sure u have :- <identity impersonate="true" /> placed in ur
web.config
Try all that!
Let me know if it works for u..if not post ur Question.
"Justin" wrote:
> No, the user is not authenticated at all, meaning it goes to the else
> statement in the code below no matter what:
> private void Login_Click(object sender, System.EventArgs e)
> {
> if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> {
> FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> }
> else
> {
> lblStatus.Text = "Authentication Failed.";
> }
> }
>
> "Patrick.O.Ige" wrote:
> > Hey Justin,
> > When u mean authorization do u mean th user can login but he is not
> > getting the appropriate resources?
> > That means is he authenticated?
> > "Justin" wrote:
> > > I am trying to password protect a subdirectory using forms authentication. I
> > > am using the "Location" tag to specify the directory to be protected. The
> > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > <location path="Admin">
> > > <system.web>
> > > <authentication mode="Forms">
> > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > <credentials passwordFormat="Clear">
> > > <user name="Admin" password="pass"/>
> > > <user name="Ashlyinn" password="pass"/>
> > > </credentials>
> > > </forms>
> > > </authentication>
> > > <authorization>
> > > <deny users="?"/>
> > > </authorization>
> > > </system.web>
> > > </location>
> > > > The problem is event if I put in the proper valid credentials authorization
> > > fails.
> > > > Any suggestions?
> > > > Thanks, Justin.
Well, unfortunetly it still does not work. I am sure its something simle but
sometimes simple problems are hard to fix.
Thanks for the help.
Justin.
"Patrick.O.Ige" wrote:
> Ok Justin so No authentication at al!!
> Are u sure u have all the right settings?
> First check to see whether u have Anonymous Auth checked in IIS.
> Got to ur WebServer and right click on ur Virtual Directory of ur
> Application >Go to Properties >Directory security TAB> On the Anonymouse
> Access and Auth control
> click EDIT and make sure u check Anonymous access!
> Also make sure u have :- <identity impersonate="true" /> placed in ur
> web.config
> Try all that!
> Let me know if it works for u..if not post ur Question.
>
> "Justin" wrote:
> > No, the user is not authenticated at all, meaning it goes to the else
> > statement in the code below no matter what:
> > private void Login_Click(object sender, System.EventArgs e)
> > {
> > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > {
> > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > }
> > else
> > {
> > lblStatus.Text = "Authentication Failed.";
> > }
> > }
> > "Patrick.O.Ige" wrote:
> > > Hey Justin,
> > > When u mean authorization do u mean th user can login but he is not
> > > getting the appropriate resources?
> > > That means is he authenticated?
> > > > > > "Justin" wrote:
> > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > am using the "Location" tag to specify the directory to be protected. The
> > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > <location path="Admin">
> > > > <system.web>
> > > > <authentication mode="Forms">
> > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > <credentials passwordFormat="Clear">
> > > > <user name="Admin" password="pass"/>
> > > > <user name="Ashlyinn" password="pass"/>
> > > > </credentials>
> > > > </forms>
> > > > </authentication>
> > > > <authorization>
> > > > <deny users="?"/>
> > > > </authorization>
> > > > </system.web>
> > > > </location>
> > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > fails.
> > > > > > Any suggestions?
> > > > > > Thanks, Justin.
Just try looking through ur code carefully ok!
Justin try looking through:-Forms Authentication here:-
http://samples.gotdotnet.com/quickstart/aspplus/
o
http://support.microsoft.com/defaul...Q301240&SD=MSDN
or
http://www.costudio.com/form_auth.asp
"Justin" wrote:
> Well, unfortunetly it still does not work. I am sure its something simle but
> sometimes simple problems are hard to fix.
> Thanks for the help.
> Justin.
> "Patrick.O.Ige" wrote:
> > Ok Justin so No authentication at al!!
> > Are u sure u have all the right settings?
> > First check to see whether u have Anonymous Auth checked in IIS.
> > Got to ur WebServer and right click on ur Virtual Directory of ur
> > Application >Go to Properties >Directory security TAB> On the Anonymouse
> > Access and Auth control
> > click EDIT and make sure u check Anonymous access!
> > Also make sure u have :- <identity impersonate="true" /> placed in ur
> > web.config
> > Try all that!
> > Let me know if it works for u..if not post ur Question.
> > "Justin" wrote:
> > > No, the user is not authenticated at all, meaning it goes to the else
> > > statement in the code below no matter what:
> > > > private void Login_Click(object sender, System.EventArgs e)
> > > {
> > > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > > {
> > > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > > }
> > > else
> > > {
> > > lblStatus.Text = "Authentication Failed.";
> > > }
> > > }
> > > > > > "Patrick.O.Ige" wrote:
> > > > > Hey Justin,
> > > > When u mean authorization do u mean th user can login but he is not
> > > > getting the appropriate resources?
> > > > That means is he authenticated?
> > > > > > > > > > "Justin" wrote:
> > > > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > > am using the "Location" tag to specify the directory to be protected. The
> > > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > > > <location path="Admin">
> > > > > <system.web>
> > > > > <authentication mode="Forms">
> > > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > > <credentials passwordFormat="Clear">
> > > > > <user name="Admin" password="pass"/>
> > > > > <user name="Ashlyinn" password="pass"/>
> > > > > </credentials>
> > > > > </forms>
> > > > > </authentication>
> > > > > <authorization>
> > > > > <deny users="?"/>
> > > > > </authorization>
> > > > > </system.web>
> > > > > </location>
> > > > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > > fails.
> > > > > > > > Any suggestions?
> > > > > > > > Thanks, Justin.
This link shoud help for sure:-
http://www.15seconds.com/issue/020220.htm
And by the way in ur Web.Config why don't u do:-
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="login.aspx"
protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="jeff" password="test" />
<user name="mike" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration
And then if u want to perform Auhtorization use the location PATH and specify
whch users can see access contents of a particular FOLDER!
GDLUCK
"Patrick.O.Ige" wrote:
> Just try looking through ur code carefully ok!
> Justin try looking through:-Forms Authentication here:-
> http://samples.gotdotnet.com/quickstart/aspplus/
> or
> http://support.microsoft.com/defaul...Q301240&SD=MSDN
> or
> http://www.costudio.com/form_auth.asp
>
>
> "Justin" wrote:
> > Well, unfortunetly it still does not work. I am sure its something simle but
> > sometimes simple problems are hard to fix.
> > Thanks for the help.
> > Justin.
> > "Patrick.O.Ige" wrote:
> > > Ok Justin so No authentication at al!!
> > > Are u sure u have all the right settings?
> > > First check to see whether u have Anonymous Auth checked in IIS.
> > > Got to ur WebServer and right click on ur Virtual Directory of ur
> > > Application >Go to Properties >Directory security TAB> On the Anonymouse
> > > Access and Auth control
> > > click EDIT and make sure u check Anonymous access!
> > > Also make sure u have :- <identity impersonate="true" /> placed in ur
> > > web.config
> > > Try all that!
> > > Let me know if it works for u..if not post ur Question.
> > > > > > "Justin" wrote:
> > > > > No, the user is not authenticated at all, meaning it goes to the else
> > > > statement in the code below no matter what:
> > > > > > private void Login_Click(object sender, System.EventArgs e)
> > > > {
> > > > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > > > {
> > > > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > > > }
> > > > else
> > > > {
> > > > lblStatus.Text = "Authentication Failed.";
> > > > }
> > > > }
> > > > > > > > > > "Patrick.O.Ige" wrote:
> > > > > > > Hey Justin,
> > > > > When u mean authorization do u mean th user can login but he is not
> > > > > getting the appropriate resources?
> > > > > That means is he authenticated?
> > > > > > > > > > > > > > "Justin" wrote:
> > > > > > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > > > am using the "Location" tag to specify the directory to be protected. The
> > > > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > > > > > <location path="Admin">
> > > > > > <system.web>
> > > > > > <authentication mode="Forms">
> > > > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > > > <credentials passwordFormat="Clear">
> > > > > > <user name="Admin" password="pass"/>
> > > > > > <user name="Ashlyinn" password="pass"/>
> > > > > > </credentials>
> > > > > > </forms>
> > > > > > </authentication>
> > > > > > <authorization>
> > > > > > <deny users="?"/>
> > > > > > </authorization>
> > > > > > </system.web>
> > > > > > </location>
> > > > > > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > > > fails.
> > > > > > > > > > Any suggestions?
> > > > > > > > > > Thanks, Justin.
Ok, I am getting closer to getting this to work the only problem is that
after loging in it redirects to default.aspx in the root directory instead of
admin/default.aspx.
How do I manualy set redirect url?
"Patrick.O.Ige" wrote:
> This link shoud help for sure:-
> http://www.15seconds.com/issue/020220.htm
> And by the way in ur Web.Config why don't u do:-
> <configuration>
> <system.web>
> <customErrors mode="Off"/>
> <authentication mode="Forms">
> <forms name="appNameAuth" path="/" loginUrl="login.aspx"
> protection="All" timeout="30">
> <credentials passwordFormat="Clear">
> <user name="jeff" password="test" />
> <user name="mike" password="test" />
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?" />
> </authorization>
> </system.web>
> </configuration>
> And then if u want to perform Auhtorization use the location PATH and specify
> whch users can see access contents of a particular FOLDER!
> GDLUCK
>
>
> "Patrick.O.Ige" wrote:
> > Just try looking through ur code carefully ok!
> > Justin try looking through:-Forms Authentication here:-
> > http://samples.gotdotnet.com/quickstart/aspplus/
> > or
> > http://support.microsoft.com/defaul...Q301240&SD=MSDN
> > or
> > http://www.costudio.com/form_auth.asp
> > "Justin" wrote:
> > > Well, unfortunetly it still does not work. I am sure its something simle but
> > > sometimes simple problems are hard to fix.
> > > > Thanks for the help.
> > > > Justin.
> > > > "Patrick.O.Ige" wrote:
> > > > > Ok Justin so No authentication at al!!
> > > > Are u sure u have all the right settings?
> > > > First check to see whether u have Anonymous Auth checked in IIS.
> > > > Got to ur WebServer and right click on ur Virtual Directory of ur
> > > > Application >Go to Properties >Directory security TAB> On the Anonymouse
> > > > Access and Auth control
> > > > click EDIT and make sure u check Anonymous access!
> > > > Also make sure u have :- <identity impersonate="true" /> placed in ur
> > > > web.config
> > > > Try all that!
> > > > Let me know if it works for u..if not post ur Question.
> > > > > > > > > > "Justin" wrote:
> > > > > > > No, the user is not authenticated at all, meaning it goes to the else
> > > > > statement in the code below no matter what:
> > > > > > > > private void Login_Click(object sender, System.EventArgs e)
> > > > > {
> > > > > if (FormsAuthentication.Authenticate(Email.Text, Password.Text))
> > > > > {
> > > > > FormsAuthentication.RedirectFromLoginPage(Email.Te xt, false);
> > > > > }
> > > > > else
> > > > > {
> > > > > lblStatus.Text = "Authentication Failed.";
> > > > > }
> > > > > }
> > > > > > > > > > > > > > "Patrick.O.Ige" wrote:
> > > > > > > > > Hey Justin,
> > > > > > When u mean authorization do u mean th user can login but he is not
> > > > > > getting the appropriate resources?
> > > > > > That means is he authenticated?
> > > > > > > > > > > > > > > > > > "Justin" wrote:
> > > > > > > > > > > I am trying to password protect a subdirectory using forms authentication. I
> > > > > > > am using the "Location" tag to specify the directory to be protected. The
> > > > > > > login.aspx page is in the root directory of the app. Here is the web.config:
> > > > > > > > > > > > <location path="Admin">
> > > > > > > <system.web>
> > > > > > > <authentication mode="Forms">
> > > > > > > <forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
> > > > > > > <credentials passwordFormat="Clear">
> > > > > > > <user name="Admin" password="pass"/>
> > > > > > > <user name="Ashlyinn" password="pass"/>
> > > > > > > </credentials>
> > > > > > > </forms>
> > > > > > > </authentication>
> > > > > > > <authorization>
> > > > > > > <deny users="?"/>
> > > > > > > </authorization>
> > > > > > > </system.web>
> > > > > > > </location>
> > > > > > > > > > > > The problem is event if I put in the proper valid credentials authorization
> > > > > > > fails.
> > > > > > > > > > > > Any suggestions?
> > > > > > > > > > > > Thanks, Justin.
trouble with passing date to stored procedure
The datetime sent to the SP is: 10/17/2004 12:00:19 AM
The datetime in the field DT_TM I am comparing to is: 2004-06-23 10:17:23.000
Just hoping someone has a good grasp on this datetime format issue since I am clueless at this point on what to do. Cause I was sending in without converting to a date and kept getting errors.
This section of code is a portion taken from my .aspx file
'----
Dim dtLogDateTime as DateTime
adoCon = New SqlConnection("Server=xx.xx.xx.xx;Database=dbname;Uid=user;Pwd=pwd")
cmdSQL = New SqlCommand("sc_add_referer", adoCon)
cmdSQL.CommandType = CommandType.StoredProcedure'Input Parameters
cmdSQL.Parameters.Add("@dotnet.itags.org.SENT_IP", arrArray2(5))
cmdSQL.Parameters.Add("@dotnet.itags.org.SENT_LOG_FILE", arFile(arFile.Length -1))
cmdSQL.Parameters.Add("@dotnet.itags.org.SENT_REFERER", arrArray2(8))
dtLogDateTime = arrArray2(0) & " " & arrArray2(1)
cmdSQL.Parameters.Add("@dotnet.itags.org.SENT_DT_TM", dtLogDateTime)'Output parameter
parmSQL = cmdSQL.Parameters.Add("ReturnValue", SqlDbType.Int)
parmSQL.Direction = ParameterDirection.ReturnValueadoCon.Open()
cmdSQL.ExecuteNonQuery()
iReturnVal = cmdSQL.Parameters("ReturnValue").ValueIf iReturnVal = -2 Then
Response.Write("<br>" & arrArray2(3) & " " & arrArray2(5))
End if
adoCon.Close()
'----
The following is the SQL Server stored procedure I am calling
Replace the "/" in the date with "-" and drop the " AM" at the end of the string. You should be good to go.
CREATE PROCEDURE sc_add_referer
(
@dotnet.itags.org.SENT_IP varchar(15),
@dotnet.itags.org.SENT_LOG_FILE varchar(15),
@dotnet.itags.org.SENT_REFERER text,
@dotnet.itags.org.SENT_DT_TM datetime
)
AS
DECLARE @dotnet.itags.org.ROW_CNT INT
DECLARE @dotnet.itags.org.ROW_ORDERID INT
DECLARE @dotnet.itags.org.ROW_DT_TM INT
DECLARE @dotnet.itags.org.SUB_CNT INT--FIRST NEED TO FIND OUT IF IN MAIN TABLE
SELECT @dotnet.itags.org.ROW_CNT = count(*), @dotnet.itags.org.ROW_ORDERID = ORDER_ID
FROM sc_ip_tracking
WHERE IP = @dotnet.itags.org.SENT_IP
GROUP BY ORDER_IDSELECT @dotnet.itags.org.SUB_CNT = count(*)
FROM sc_ip_tracking_referers
WHERE ORDER_ID = @dotnet.itags.org.ROW_ORDERID
AND LOG_FILE = @dotnet.itags.org.SENT_LOG_FILEIF @dotnet.itags.org.ROW_CNT > 0
-- IP FOUND SO SEE IF FOUND IN REFERER LOG
IF @dotnet.itags.org.SUB_CNT > 0
--ROW ROUND
RETURN 0
ELSE
-- NO ROW FOUND SO NEED TO ADD INFO
BEGIN
SELECT @dotnet.itags.org.ROW_DT_TM = datediff(hour, @dotnet.itags.org.SENT_DT_TM, DT_TM) FROM sc_ip_tracking WHERE IP = @dotnet.itags.org.SENT_IP AND ORDER_ID = @dotnet.itags.org.ROW_ORDERIDIF @dotnet.itags.org.ROW_DT_TM >= 0 AND @dotnet.itags.org.ROW_DT_TM <= 8
BEGIN
INSERT INTO sc_ip_tracking_referers (ORDER_ID, LOG_FILE, REFERER, LAST_CHANGE_DT)
values (@dotnet.itags.org.ROW_ORDERID, @dotnet.itags.org.SENT_LOG_FILE, @dotnet.itags.org.SENT_REFERER, getdate())
END
RETURN -2
END
ELSE
RETURN 0
GO
Trouble with QueryString
I access a particular page by specifying the page's name and extension like
so:
http://localhost:xxxx/MyFiles/Lucky/
The Lucky directory contains a webpage named Default.aspx. I can access is
without needing to type in the page's name and
extension. This page uses a querystring and is only specified when needed (
e.g. keywords=sam). My trouble is that if I
access the page without specifying the page's name and extension, somehow th
e querystring is given a value on its own.
Debugging reveals that the querystring contains the value of "default.aspx"
What could be causing this issue? I've been at this for a few hours now wit
h no luck. Any help would be greatly appreciated.
Thanks,
RoshawnRoshawn,
Are you doing any URL rewriting or redirection? I've seen this
before when doing redirection and not filtering out the default page as a
possible value.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"Roshawn" <radawson218@.yahoo.com> wrote in message
news:%2374iTQNRHHA.2124@.TK2MSFTNGP06.phx.gbl...
> Hi,
> I access a particular page by specifying the page's name and extension
> like so:
> http://localhost:xxxx/MyFiles/Lucky/
> The Lucky directory contains a webpage named Default.aspx. I can access
> is without needing to type in the page's name and extension. This page
> uses a querystring and is only specified when needed (e.g. keywords=sam).
> My trouble is that if I access the page without specifying the page's name
> and extension, somehow the querystring is given a value on its own.
> Debugging reveals that the querystring contains the value of
> "default.aspx"
> What could be causing this issue? I've been at this for a few hours now
> with no luck. Any help would be greatly appreciated.
> Thanks,
> Roshawn
Hmm, you're absolutely right!
I am doing URL rewriting, using Regex of course. I discovered that one of m
y Regex rules was incorrect. That's what was
causing the trouble as I wasn't filtering out the default page.
Thanks for the help, :-)
Roshawn
Mark Fitzpatrick wrote:
> Roshawn,
> Are you doing any URL rewriting or redirection? I've seen this
> before when doing redirection and not filtering out the default page as a
> possible value.
>
Trouble with QueryString
I access a particular page by specifying the page's name and extension like so:
http://localhost:xxxx/MyFiles/Lucky/
The Lucky directory contains a webpage named Default.aspx. I can access is without needing to type in the page's name and
extension. This page uses a querystring and is only specified when needed (e.g. keywords=sam). My trouble is that if I
access the page without specifying the page's name and extension, somehow the querystring is given a value on its own.
Debugging reveals that the querystring contains the value of "default.aspx"
What could be causing this issue? I've been at this for a few hours now with no luck. Any help would be greatly appreciated.
Thanks,
RoshawnRoshawn,
Are you doing any URL rewriting or redirection? I've seen this
before when doing redirection and not filtering out the default page as a
possible value.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Roshawn" <radawson218@.yahoo.comwrote in message
news:%2374iTQNRHHA.2124@.TK2MSFTNGP06.phx.gbl...
Quote:
Originally Posted by
Hi,
>
I access a particular page by specifying the page's name and extension
like so:
>
http://localhost:xxxx/MyFiles/Lucky/
>
The Lucky directory contains a webpage named Default.aspx. I can access
is without needing to type in the page's name and extension. This page
uses a querystring and is only specified when needed (e.g. keywords=sam).
My trouble is that if I access the page without specifying the page's name
and extension, somehow the querystring is given a value on its own.
Debugging reveals that the querystring contains the value of
"default.aspx"
>
What could be causing this issue? I've been at this for a few hours now
with no luck. Any help would be greatly appreciated.
>
Thanks,
Roshawn
Hmm, you're absolutely right!
I am doing URL rewriting, using Regex of course. I discovered that one of my Regex rules was incorrect. That's what was
causing the trouble as I wasn't filtering out the default page.
Thanks for the help, :-)
Roshawn
Mark Fitzpatrick wrote:
Quote:
Originally Posted by
Roshawn,
Are you doing any URL rewriting or redirection? I've seen this
before when doing redirection and not filtering out the default page as a
possible value.
>
Tuesday, March 13, 2012
Troubled authentication in subdirectories
I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.
The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:
http://www.theserverside.net/tt/art...mAuthentication
The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the protected
subdirectory.
Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:
Error 1 It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS. D:\WebSites\RegencyWeb\web.config 42
If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.
So how can I solve this?
Thanks for any insight,
-BentonYou can only have one authentication section in a web application. You don't
solve this, it's by design. The only thing you can do is alter the login
page based upon where the user is coming from, ie: which subdirectory. The
only other way is to make the subdirectories their own independent
application spaces. Of course, you can specify whatever authorization
limitations you want in the specific subdirectories, that doesn't matter,
just keeping in mind there can only be one authentication section and one
logon page.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Benton" <conversar@.gmail.comwrote in message
news:56jam8F27vd09U1@.mid.individual.net...
Quote:
Originally Posted by
Hi there,
>
I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.
>
The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:
>
http://www.theserverside.net/tt/art...mAuthentication
>
The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the
protected subdirectory.
>
Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:
>
Error 1 It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS. D:\WebSites\RegencyWeb\web.config 42
>
If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.
>
So how can I solve this?
>
Thanks for any insight,
>
-Benton
Troubled authentication in subdirectories
I want to have an unrestricted root directory and some protected
subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
have its own Login.aspx page.
The following article is a good start, but it uses a single Login.aspx
located in the root directory to protect a subdirectory:
[url]http://www.theserverside.net/tt/articles/showarticle.tss?id=FormAuthentication[/ur
l]
The technique described in the article uses a "location" section in
web.config, where a custom "system.web" section is defined for the protected
subdirectory.
Now if I put the "authentication mode" section inside this custom
"system.web" for the subdirectory (so I can define the subdirectory Login
page), I get a compiler error on the "authentication" section:
Error 1 It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application
in IIS. D:\WebSites\RegencyWeb\web.config 42
If I put the "authentication" section in the root "system.web" (outside of
the location's "system.web") then the application compiles fine, but I'm
limited to a single Login.aspx for the application.
So how can I solve this?
Thanks for any insight,
-BentonYou can only have one authentication section in a web application. You don't
solve this, it's by design. The only thing you can do is alter the login
page based upon where the user is coming from, ie: which subdirectory. The
only other way is to make the subdirectories their own independent
application spaces. Of course, you can specify whatever authorization
limitations you want in the specific subdirectories, that doesn't matter,
just keeping in mind there can only be one authentication section and one
logon page.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"Benton" <conversar@.gmail.com> wrote in message
news:56jam8F27vd09U1@.mid.individual.net...
> Hi there,
> I want to have an unrestricted root directory and some protected
> subdirectories on my ASP.NET 2.0 application. I want each subdirectory to
> have its own Login.aspx page.
> The following article is a good start, but it uses a single Login.aspx
> located in the root directory to protect a subdirectory:
> [url]http://www.theserverside.net/tt/articles/showarticle.tss?id=FormAuthentication[/
url]
> The technique described in the article uses a "location" section in
> web.config, where a custom "system.web" section is defined for the
> protected subdirectory.
> Now if I put the "authentication mode" section inside this custom
> "system.web" for the subdirectory (so I can define the subdirectory Login
> page), I get a compiler error on the "authentication" section:
> Error 1 It is an error to use a section registered as
> allowDefinition='MachineToApplication' beyond application level. This
> error can be caused by a virtual directory not being configured as an
> application in IIS. D:\WebSites\RegencyWeb\web.config 42
> If I put the "authentication" section in the root "system.web" (outside of
> the location's "system.web") then the application compiles fine, but I'm
> limited to a single Login.aspx for the application.
> So how can I solve this?
> Thanks for any insight,
> -Benton